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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Dynamic Ranking within a category

Hi All,
I am trying to build a visual which shows dynamic rank for Patients falling in each category, and that ranking should get updated as per the Date filtered. This is the original rank based on category

 

CategoryPatientDateRank(based on Date)
aABC1/1/20221
aDEF2/28/20222
bABC1/1/20221
b

EFG

 

1/15/20222
bDSF2/15/20223

 

If i exclude 1/1/2022 from date filter, this is how the visual should look like:

CategoryPatientDateRank(based on Date)
aDEF2/28/20221
b

EFG

 

1/15/20221
bDSF2/15/20222

 

Thanks in Advance!

1 ACCEPTED SOLUTION

@Anonymous , if you are creating a column Rank.

 

Rank = rankx(filter(Table, [Category] = earlier([Category]) , [Date],,asc,dense)

 

But I think you need a measure

 

Countx(filter(allselected(Table) , [Category] = Max([Category])  && [Date] <= Max([Date]) ), [Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Just to Clarify, i need help with creating this Rank measure/ Column. I have either been able to create rank by Category that doesnt update as per date filter OR create dynamic rank that doesn't rank by category.  

Anonymous
Not applicable

Hi,

I think this  thread hold your solution: https://community.powerbi.com/t5/Desktop/Dynamic-ranking-of-data-based-on-filter-selections-with/td-...

I hope that helps 🙂 

Anonymous
Not applicable

Hi, Thanks for helping. I tried creating calculated column(similar to Rank by Test Type in mentioned post) but i see only 1 getting populated for each row.

@Anonymous , if you are creating a column Rank.

 

Rank = rankx(filter(Table, [Category] = earlier([Category]) , [Date],,asc,dense)

 

But I think you need a measure

 

Countx(filter(allselected(Table) , [Category] = Max([Category])  && [Date] <= Max([Date]) ), [Date])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.