Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Groupby with condition

Hello. My data has 2 fields: Order_Num and Volume.    I have repeated Order_num when a customer bought more than 1 item and each volume's entry correspond to the volume calculated with the itens' d...
  • nandic's avatar
    6 years ago

    Anonymous ,

    If you would like to keep original table, in Power Query right click on table name and choose duplicate.
    From now on working on duplicated query:
    Go on home tabe and choose group by. Group by column Order Number and add 3 aggregations:
    1) Items count - how many records per Order Number
    2) Items = 0 - returns min value for Value. If there is value with 0 it will return 0. Based on this column you will hide/remove these rows
    3) Sum amount - sum of volume 
    My demo screenshots below:



    Filter column Items = 0 (uncheck 0 from list).
    Filter column Items count - (uncheck 1 from list to get only Order numbers with multiple items)
    Click save and apply and you have a new list of orders.