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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jcastr02
Post Prodigy
Post Prodigy

get column header for max column

I have below "DE MAX" column that gets the maxiumum value in the row.  I'd like to be able to get the column name of the item where the max value was found.  At times the max value may be shared between two values.  See below Desired result column.  Any help is appreciated.  Id like to be able to do this in PQ.

StoreDE/F1 BaseDE/F1 HTSDE/F1 Patient ExperienceDE Special Projects and Temp SupportDE MAXDESIRED RESULT
24921.30.151.451.31.45DE/F1 Patient Experience
51031.3nullnull1.31.3DE Special Projects and Temp Support; DE/F1 Base
53881.3nullnull1.31.3DE Special Projects and Temp Support; DE/F1 Base
54441.3nullnull1.31.3DE Special Projects and Temp Support; DE/F1 Base
93131.30.15null1.31.3DE Special Projects and Temp Support; DE/F1 Base
51841.3null0.61.31.3DE/F1 Patient Experience
1 ACCEPTED SOLUTION
spinfuzer
Solution Sage
Solution Sage

You can add custom column.  I am not sure how the last one does not include base.

 

Text.Combine(List.RemoveItems(List.Transform(List.PositionOf(Record.ToList(_),[DE MAX], Occurrence.All), (x) => Record.FieldNames(_){x}), {"DE MAX"}),";")

View solution in original post

2 REPLIES 2
spinfuzer
Solution Sage
Solution Sage

You can add custom column.  I am not sure how the last one does not include base.

 

Text.Combine(List.RemoveItems(List.Transform(List.PositionOf(Record.ToList(_),[DE MAX], Occurrence.All), (x) => Record.FieldNames(_){x}), {"DE MAX"}),";")

Thank you This worked, sorry that last row was a mistake on my part base would have been included

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.