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
navedkhan
Helper III
Helper III

Help Required - Identify Highest Values in a row and return Column Header into another column name

Hi Friends - am looking for a help with the below sample data;

 

DateTeam0-2 days3-5 days>5 daysAgeing Band
01 09 2020ABC102560>5 days
02 09 2020XYZ015103-5 days
03 09 2020STC201310-2 days

 

My requirement is as follows;

1) To identify Highest values in a given row and return corresponding Column Header name into another calculated column named 'Ageing Band'

 

Please can you help me with DAX for this calculated column?

 

3 REPLIES 3
negi007
Community Champion
Community Champion

@navedkhan You can achive your result using power query as well like below

 

Step 1. 

negi007_1-1600926962826.png

 

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjBUMLBUMDIwMlDSUXJ0cgaShiCmkSmQMAOxYkoNDIxTTRVSEiuLlWJ1gFqMkLREREYBSRDL0BSm11gXWbUxkurgEJAFYKahMYgA6dU1gqqOBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Team = _t, #"0-2 days" = _t, #"3-5 days" = _t, #">5 days" = _t, #"Ageing Band" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Team", type text}, {"0-2 days", Int64.Type}, {"3-5 days", Int64.Type}, {">5 days", Int64.Type}, {"Ageing Band", type text}}),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Changed Type", {"0-2 days", "3-5 days", ">5 days"}, "Attribute", "Value")
in
#"Unpivoted Only Selected Columns"

 

Step 2: Use Matrix visual like below

 

negi007_2-1600927055848.png

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Anonymous
Not applicable

Hey, you could give a try to this

 

Ageing band =
if(calculate(sum([0-2 days])) > calculate(sum([3-5days])) && calculate(sum([0-2 days])) > calculate(sum([>5days])), ">5 days", 

if(calculate(sum([3-5 days])) > calculate(sum([0-2days])) && calculate(sum([3-5days])) > calculate(sum([>5days])), "3-5 days",

"0-2 days"))

amitchandak
Super User
Super User

@navedkhan , Create a new column like

 

switch( true() ,
[0-2 days] > [3-5 days] && [0-2 days] > [>5 days] , "0-2 days",
[3-5 days]> [>5 days] , "3-5 days",
">5 days"
)

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.