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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
saranee
Helper I
Helper I

Dynamic ranking based on date

Hi all,

 

Request your help on this.

 

We are basically having a table with Name,Date and based on date we are assigning Rank.

We have calculated column to calculate rank:RANKX(FILTER(Table1,Table1[Name]=EARLIER(Table1[Name])),Table1[Date],,DESC,Dense)

 

rank1.png

 

But when we are changing date filter i.e going to back date rank is not getting updated accordingly.For e.g for A when we changed date filter from 15 feb to 8 Feb then A on 3rd Feb will be having rank as 1 but still it remains 2.

 

rank2.png

 

Please can we have a solution for this.

 

Thanks,
saranee

1 ACCEPTED SOLUTION

@saranee

 

Try this MEASURE for dynamic RANKING

 

RANK =
RANKX (
    FILTER ( ALLSELECTED ( Table1 ), Table1[Name] = SELECTEDVALUE ( Table1[Name] ) ),
    CALCULATE ( SELECTEDVALUE ( Table1[Date] ) ),
    ,
    DESC,
    DENSE
)

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hello,

 

I want to create a new column ranking on the basis of certain values in a column (AHT). However, I want the ranking to be filtered according to the Date. I mean it should rank the values in AHT, if I filter the date to Jan-22 then it should give me ranking on the basis of date and not for overall dates.

 

EcodeEnameAHTDate
45654A382Jan-22
45655B289Jan-22
45654A351Feb-22

 

 

 

Hi,

Download my PBI file from here.  Let me know if this is working well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Ashish_Mathur
Super User
Super User

Hi,

 

Try this measures

 

Date value=SUM(Table1[Date])

Rank=RANKX(ALL(Table1[Date]),[Date value])

 

If this does not help, then share the link from where i can download your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
ricardocamargos
Continued Contributor
Continued Contributor

Hi @saranee,

 

Why don't u use measure instead of calculated column ?

 

Ricardo

HI Richard,

 

We will be then unable to use EARLIER in measure.Please can you suggest some alternative as we want seperate set of names and then trying to find rank.

 

Thanks,

saranee

Hi @saranee,

 

Try this code:

 

_Index =
IF(ISBLANK(CALCULATE(COUNTROWS(Table2); FILTER(ALLSELECTED(Table2[Date]); Table2[Date] < MAX(Table2[Date]))));
1;
CALCULATE(COUNTROWS(Table2); FILTER(ALLEXCEPT(Table2; Table2[Name]); Table2[Date] < MAX(Table2[Date]))) + 1)

 

Ricardo

@saranee

 

Try this MEASURE for dynamic RANKING

 

RANK =
RANKX (
    FILTER ( ALLSELECTED ( Table1 ), Table1[Name] = SELECTEDVALUE ( Table1[Name] ) ),
    CALCULATE ( SELECTEDVALUE ( Table1[Date] ) ),
    ,
    DESC,
    DENSE
)
Anonymous
Not applicable

Kudos on this solution

Anonymous
Not applicable

@Zubair_Muhammad Thanks for the solution, it worked seamlessly. 

@Zubair_Muhammad Thats the correct solution!!

Hi @rishikdutta1987,

Please mark the right solution as answer, so more people like you can find the solution easily.

Best Regards,
Angelia

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors