Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Group by function

Hi gurus,

I have to use group by for filtering Max values in my data set but there is a weird thing happening. I was wondering what

Group by

function is doing? Here is my dataset and the job I need to do:

2019-07-27_19-28-00.jpg

Group by Ticket 
New column name:                                Operation:                                   Column:
Max                                              Maximum                                      Max

and the second situation when I have Qty as one of my column:

2019-07-27_19-28-55.jpg

First I merged Ticket&Qty with comma seperator and then I used Group by: Ticket&Qty and Maximum by Max cloumn.

The final result is so different:

in the first situation I have 166 rows after grouping them and in second situation I have 205 rows!

My question is why there is such a big descripancy and what exactly is Group by function does?

Thanks

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous it is gong to return maximum value of unique value of group by columns

 

in 1st case, take unique ticket number and give the maximum qty

in 2nd case, take unique of ticket number & qty (concatenated file) and give the max qty and I expect more rows in 2nd case depending on data.

 

here is example

Ticket Qty

1       10

1       20

2       40

2       50

2       50

 

In first case, i will get two rows

Ticket    Max Qty

1             20 

2             50

 

in 2nd case I will get 4 rows

Ticket,Qty         Max Qty

1,10                    10

1,20                    20

2,40                    40

2,50                    50



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

1 REPLY 1
parry2k
Super User
Super User

@Anonymous it is gong to return maximum value of unique value of group by columns

 

in 1st case, take unique ticket number and give the maximum qty

in 2nd case, take unique of ticket number & qty (concatenated file) and give the max qty and I expect more rows in 2nd case depending on data.

 

here is example

Ticket Qty

1       10

1       20

2       40

2       50

2       50

 

In first case, i will get two rows

Ticket    Max Qty

1             20 

2             50

 

in 2nd case I will get 4 rows

Ticket,Qty         Max Qty

1,10                    10

1,20                    20

2,40                    40

2,50                    50



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.