Forum Discussion

dogburalHK82's avatar
dogburalHK82
Helper III
3 years ago
Solved

group by with condition

Hi, 

 

in power query, when groping rows is there any way using Power M to pick column from each column as below

 

For Quanity ordered column, select maxium value

For remaining, columns are selected from the row where Receipt date is bigger 

 

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi dogburalHK82 ,

     

    Here's my sample data. I also added a third row for a better demo. A column of Group IDs has also been added, and I think you have a similar column in your data for grouping.

    Here's my solution.

    1.You can group like this.

     

    2.Expand rows.

    3.Add a conditional column.

     

    4.Filter out "0".


     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.           

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi dogburalHK82 ,

     

    Here's my sample data. I also added a third row for a better demo. A column of Group IDs has also been added, and I think you have a similar column in your data for grouping.

    Here's my solution.

    1.You can group like this.

     

    2.Expand rows.

    3.Add a conditional column.

     

    4.Filter out "0".


     

    Best Regards,

    Stephen Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.