How to see matching rows for aggregates max/min? #1094
-
I really like how the frequency chat links back to the rows in the original sheet for selection or dive row takes you to a sheet with the matching rows. When you are using an aggregates max/min on a column is there an easy way to either select only the rows that match the max/min or dive to a sheet with rows that match the max/min? Like here I add a max to a column, but can Visidata select the rows that match the max in the original sheet: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Maybe there's a simpler way, but I've just started using the tool, so you know... :-) Given:
The result should be now:
|
Beta Was this translation helpful? Give feedback.
-
Hi @danadam! Happy to see your response. Thank you for taking the time to respond. I haven't had a chance to try this out, but it seems like it might work. Will it work if there is more than one max per category? Like if in your sample table the first row also said "This is max" It does seem like a lot of steps, I did want something that was a little easier. The Frequency Sheet provides the ability to make changes directly on the source sheet. I like your solution since it uses joining back to the source sheet. Maybe if there was an easier way to do that join given VisiData already knows what the indexes you used to generate the Frequency Sheet. Saul has recently added some code for providing a window of values, but I haven't spent the time to look at it either. I thought it would be useful if VisiData had something like the SQL window function. |
Beta Was this translation helpful? Give feedback.
-
Yes.
Well, not like that. We don't compare on "Description" column, we only take "Description" corresponding to max "Value". So, if we had another row with value 3, like:
then the result would be:
|
Beta Was this translation helpful? Give feedback.
-
Thanks @danadam I think that is a useful way to use the Frequency sheet to join back to the original sheet. I haven't done this query recently, but when I do I think this will be useful. I am interested in having the rows in the original sheet selected, while still keeping the other non-max rows. I want to use selection expansion as discussed in #1327 I think an outer join can be used in this case, and select rows that have values in the max column. |
Beta Was this translation helpful? Give feedback.
Maybe there's a simpler way, but I've just started using the tool, so you know... :-)
Given: