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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.