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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
NB689
Helper I
Helper I

Help with RANKX

I have looked through some other threads and articles online but I can't sort out what my issue is that I'm having with RANKX.

 

My goal is to have a ranking that ranks by user ID, and will auto update the ranking based on the filters applied to my table.

 

I have am using this formula for my RankX: 

RANKX = RANKX(ALLSELECTED('Non Overlapping') , [Average Personal Time],,DESC,Dense )

Here you can see the results for my "RANKX" column aren't coming out correctly. My intended output would be row 1 to be 1, then 2, 3, etc. 

NB689_0-1666651530456.png

Thank you

1 ACCEPTED SOLUTION

This took some trial and error, but I ended up solving my issue. One change I am going to make is I would like for the ranking to not duplicate the ranking in the event of a tie and I would like the ranking to update when I filter the data, but other than those changes it looks like this is working.

Rank X Personal Time = 
RANKX(ALL('Non Overlapping'[User ID]), CALCULATE(SUM('Non Overlapping'[After Hours] ) , ALLEXCEPT('Non Overlapping', 'Non Overlapping'[User ID])),,DESC,Dense)

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I cannot know how your datamodel looks like, but please try something like below.

Or, please share your sample pbix file's link.

 

RANKX measure =
RANKX (
    SUMMARIZE (
        ALLSELECTED ( 'Non Overlapping' ),
        'TableName1'[Group],
        'TableName2'[Region],
        'TableName3'[Division],
        'TableName4'[UserID],
        'TableName5'[Specialities]
    ),
    [Average Personal Time],
    ,
    DESC,
    DENSE
)


 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Here's what our data looks like. The file is rather large right now and hase some sensitive data, but if you need more information I can provide that.

NB689_0-1666966808264.png

 

The measure for Average Personal Time looks like this:

Average Personal Time 3 = IFERROR( 
    SUM('Non Overlapping'[After Hours]) / 
    DISTINCTCOUNT('Non Overlapping'[Login Number]) / 
    (CALCULATE(DISTINCTCOUNT('Non Overlapping'[User ID]), FILTER('Non Overlapping', 'Non Overlapping'[After Hours]>0)) +0)
, 0)

 

This took some trial and error, but I ended up solving my issue. One change I am going to make is I would like for the ranking to not duplicate the ranking in the event of a tie and I would like the ranking to update when I filter the data, but other than those changes it looks like this is working.

Rank X Personal Time = 
RANKX(ALL('Non Overlapping'[User ID]), CALCULATE(SUM('Non Overlapping'[After Hours] ) , ALLEXCEPT('Non Overlapping', 'Non Overlapping'[User ID])),,DESC,Dense)

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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