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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AntWickenden
Frequent Visitor

Selecting highest result from 4 values and displaying a description for that.

I have been replicating a retired excel KPI pack within Power BI and have come across something I need help with.

 

The KPI pack relates to shipping and includes delays in the door to door shipping process broken out into the following elements.

 

1) Days Late at Origin Delivery

2) Days Late During Origin Consolidation

3) Days Late During Vessel at Sea

4) Days Late During Delivery to DC

 

In the dataset, I have some calculations which determines where the biggest delay is happening and I need to return the description as listed above for those delays.

 

I have created a DAX measure which does this for me as follows...

 

Maximum Delay Reason =
VAR MaxPrice =
 MAX( 'Grouped: PO_Level (OINDC Delay Analysis)'[Value] )
RETURN
 CALCULATE (
 SELECTEDVALUE ( 'Grouped: PO_Level (OINDC Delay Analysis)'[Delay Reason] ),
 'Grouped: PO_Level (OINDC Delay Analysis)'[Value] = MaxPrice
 )

 

This works, except I have an issue if the biggest delay is the same for 2 of the reasons...example as follows...

 

Days Late at Origin Delivery = 4 days

Days Late During Origin Consolidation = 2 days

Days Late During Vessel at Sea = 4 days

Days Late During Delivery to DC = 1 day

 

In this case, PowerBi does not know how to handle the fact there are 2 highest reasons and returns a blank instead.

 

Any ideas on how I can fix this? I'm happy for any method to be used to decide on a reason code (sort alphabetically maybe) as long as I get a reason instead of a blank.

 

Many thanks in advance

 

2 REPLIES 2
amitchandak
Super User
Super User

@AntWickenden , My advice would be to create Rank or TOPN and use them as a visual level filter or use the Index function.

 

In the above case also create a count measure and plot with Delay Reason

 

TOPN: https://youtu.be/QIVEFp-QiOk
TOPN with Numeric Parameter -https://youtu.be/cN8AO3_vmlY?t=26448

 

Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks @amitchandak 
Let me try that and see what happens...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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