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! Request now

Reply
DataVitalizer
Solution Sage
Solution Sage

RANKX missing values or redendant

Hi Community,

I have a table called "MyTable" with 3 columns (Category, SubCategory, Date)

I added a column using this DAX code to rank subcategories within each group by date:

MyRanking= 
RANKX
(FILTER(ALL(MyTable),
MyTable[Category] = EARLIER(MyTable[Category])
),
MyTable[Date],,,Dense)

Here are the faces issues :
1. for some categories I get the same ranking when subcategories have the same date
2. for some categories some ranking numbers are missing.

Any suggestions?
Thank you in advance

2 REPLIES 2
amitchandak
Super User
Super User

@DataVitalizer , for column try like

 

MyRanking=
RANKX(FILTER((MyTable),
MyTable[Category] = EARLIER(MyTable[Category])
MyTable[SubCategory] = EARLIER(MyTable[SubCategory])
),
MyTable[Date],,asc,Dense)

 

For measure you can use new rank or rownumber

rank(DENSE,ALLSELECTED(MyTable[Category],MyTable[SubCategory],MyTable[Date]),ORDERBY([Date],asc))

 

add partitionBy if needed

 

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

This time I had only one value for all subCategories "1" 

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