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
eden
Helper I
Helper I

Ranking date and breaking ties ?

Hello 

 how to rank this table   based on start date excluding status = published 

 

WorkorderStatuscustomer start dateEnd Date
Onepublishedabc01/08/202024/09/2020
tworevieweddef24/09/202001/11/2020
threewaitingxyz17/09/202012/01/2021
fourdeferedabc 01/12/202003/06/2021
fivepublishedoiu01/07/202023/12/2021
sixin progressabc 22/05/201901/09/2020
sevenin progressdef21/07/201921/08/2020
eightin progresskjs21/08/201912/11/2020

 

 If the date are same ties needs to be broken using the end date 

 

Regards

 

1 ACCEPTED SOLUTION

Hi @eden ,

 

Create a measure

 

BREAK = RANKX(FILTER(ALL('Table'),'Table'[start date] = MAX('Table'[start date])),CALCULATE(MAX('Table'[End Date])))
 
Then create the RANK measure
 
Ranking = IF( MAX('Table'[Status]) = "published" , BLANK(),
RANKX(FILTER(ALL('Table'),'Table'[Status] <> "published"),CALCULATE(MAX('Table'[start date])+ [BREAK])))
 
 
1.jpg
 
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

7 REPLIES 7
eden
Helper I
Helper I

@ harshnathani Check the ranking 7 , different dates were ranked as same in order
harshnathani
Community Champion
Community Champion

Hi @eden ,

 

Ranking = IF( MAX('Table'[Status]) = "published" , BLANK(),
RANKX(FILTER(ALL('Table'),'Table'[Status] <> "published"),CALCULATE(MAX('Table'[start date]))))
 
1.jpg
 
If this is not the output you desire, please share the output in the sample you have provided.
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

@harshnathani 

 

How to break the ties ? 

Hi @eden ,

 

Create a measure

 

BREAK = RANKX(FILTER(ALL('Table'),'Table'[start date] = MAX('Table'[start date])),CALCULATE(MAX('Table'[End Date])))
 
Then create the RANK measure
 
Ranking = IF( MAX('Table'[Status]) = "published" , BLANK(),
RANKX(FILTER(ALL('Table'),'Table'[Status] <> "published"),CALCULATE(MAX('Table'[start date])+ [BREAK])))
 
 
1.jpg
 
 
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

harshnathani

Powe.JPG

 

Hi @eden ,

 

This is because your start date and end date for 2 rows are same.

 

Try adding RAND() to break the ties.

 

Ranking = IF( MAX('Table'[Status]) = "published" , BLANK(),
RANKX(FILTER(ALL('Table'),'Table'[Status] <> "published"),CALCULATE(MAX('Table'[start date])+ [BREAK]+ RAND())))
 

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.