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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Rank Issue

Hi All,

I am trying to rank a value field, but I am getting the rank as below.

Can Someone explain me what I am doing wrong here, how can I resolve this.

Thanks in advance!

 

Rank.PNG

 

 

 

Regards,

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

this is because empty values (NULL) are treated as 0 (zero), for this reason there are a lot of rows ranked with the value 13.

 

This behavior is explained here:
https://msdn.microsoft.com/en-us/library/gg492185.aspx

 

If you want to avoid this, you have to make sure that rows with an empty value have to be filtered out.

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

this is because empty values (NULL) are treated as 0 (zero), for this reason there are a lot of rows ranked with the value 13.

 

This behavior is explained here:
https://msdn.microsoft.com/en-us/library/gg492185.aspx

 

If you want to avoid this, you have to make sure that rows with an empty value have to be filtered out.

 

Hope this helps



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hi TomMartens,

 

Thanks for your input,I am able to get the expected data except that my Rank is duplicated due to ties. Is there any

workaround to break the ties and get the rank in sequential order(38,39,40...)

 

 

Capture.PNG

@Anonymous

 

You can break ties using something similar to my post in this thread:

https://community.powerbi.com/t5/Desktop/How-to-Rank-a-list-based-on-2-values-double-rankX/td-p/44008

 

I think your measure will look something like this.

  • TableForRanking refers to the table over which the ranks are computed - this could be an expression (filtering out blanks for instance). You may want to assign this to a variable.
  • [Primary Measure] is I think [Calculation 1] in your case.
  • PhysicalTable should be replaced with the name of the physical table that contains the date column.

 

Rank with ties broken =
RANKX (
    TableForRanking,
    RANKX ( TableForRanking, [Primary Measure],, ASC )
        + DIVIDE (
            RANKX (
                TableForRanking,
                PhysicalTable[Date],
                CALCULATE ( MAX ( PhysicalTable[Date] ) ),
                ASC
            ),
            ( COUNTROWS ( TableForRanking ) + 1 )
        )
)

It might be easier for you to post more details on the table/measure names or a sample pbix file to get the code exactly right.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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