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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

Power Query Grouping Question

What grouping operation in power query could I do to pull out ONLY the supplier Key and leader with the most spend on an individual supplier key.

 

jjanecm_0-1649170568799.png

That supplier has 2 leaders on it. My goal is to make a table of ONLY supplier key and leader with most spend.

 

Mark Janecek

PTP Metrics Analyst 

Johnson Controls

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc4xCsAgDIXhu2R2MIlRexZxKNSh4CCW3r9mEYS6Pfj44aUEz9tavUu3CAZqOa/SdaGXANn8OqmLHKvTdFZHG3buxiIk3Lloz2JX5+leexFe3U0P2keUnUftA45/+QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, LeaderName = _t, Spend = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", type text}, {"LeaderName", type text}, {"Spend", Int64.Type}}),
 #"Grouped rows" = Table.Group(Source, {"Key"}, {{"NiceTable", each Table.AddIndexColumn(Table.Sort(_,{{"Spend", Order.Descending}} ), "Index",1,1), type table}} ),
    #"Expanded NiceTable" = Table.ExpandTableColumn(#"Grouped rows", "NiceTable", {"LeaderName", "Spend", "Index"}, {"LeaderName", "Spend", "Index"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded NiceTable", each ([Index] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"})
in
    #"Removed Columns"

 

get max info.jpg

If the above one can't help you get the desired result, please provide some sample data in supplier info table and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dc4xCsAgDIXhu2R2MIlRexZxKNSh4CCW3r9mEYS6Pfj44aUEz9tavUu3CAZqOa/SdaGXANn8OqmLHKvTdFZHG3buxiIk3Lloz2JX5+leexFe3U0P2keUnUftA45/+QM=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Key = _t, LeaderName = _t, Spend = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Key", type text}, {"LeaderName", type text}, {"Spend", Int64.Type}}),
 #"Grouped rows" = Table.Group(Source, {"Key"}, {{"NiceTable", each Table.AddIndexColumn(Table.Sort(_,{{"Spend", Order.Descending}} ), "Index",1,1), type table}} ),
    #"Expanded NiceTable" = Table.ExpandTableColumn(#"Grouped rows", "NiceTable", {"LeaderName", "Spend", "Index"}, {"LeaderName", "Spend", "Index"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded NiceTable", each ([Index] = 1)),
    #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"})
in
    #"Removed Columns"

 

get max info.jpg

If the above one can't help you get the desired result, please provide some sample data in supplier info table and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

How to upload PBI in Community

Best Regards

amitchandak
Super User
Super User

@Anonymous , refer if this can help

https://gorilla.bi/power-query/using-table-max/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.