-
|
Loving visidata so far, curious to know how to perform multi column aggregations, is it possible via existing cmds or does it need a plugin? |
Beta Was this translation helpful? Give feedback.
Answered by
midichef
Dec 9, 2025
Replies: 1 comment 3 replies
-
|
Can you give a specific example of what you want, including a sample data set? In a simple case, you can often use you could calculate a weighted mean of |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the command
addcol-aggregate. It groups rows by the key column, then calculates an aggregator for the group.So, make
product_codethe key column using!. Then create 2 aggregates on the grouped rows: the sum of each product'squantity, and the sum of each order'squantity*price. The full list of keystrokes would be:=quantity*priceEnter%^order_revenueNavigate to the
product_codecolumn, then press!.Navigate to the
order_revenuecolumn, thenSpaceaddcol-aggregateEntersum.Navigate to
quantity, thenSpaceaddcol-aggregateEntersum.=order_revenue_sum / quantity_sumEnter^avg_product_priceNote that when you edit the cells or add new rows,
=will update its calculated resu…