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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
vendersonalias0
Frequent Visitor

Help with Date Slicer in RANKX measure

Hi I'm having trouble getting date slicers to work with my rank measure, slicing by other dimensions works flawlessy, it is just when date is introduced that the ranking breaks.

 

I've created a similar mock dataset of car sales and this is what it looks like below. AVG sales price is a simple measure dividing revenue by number of sales and is the measure I want to rank these cars by.

 

Example 1.PNG

 

My goal is to create a ranking based on the AVG sale price which changes dynamically when slicing by Car Make, Car Year, Color, Date etc.

 

With this measure I am able to get everything working other than by date

 

Avg Sale Price Rank = RANKX(
                                                 ALLSELECTED('Car Sales Mock'),
                                                 CALCULATE([Avg Sale Price],
                                                 ALLEXCEPT('Car Sales Mock','Car Sales Mock'[Car Make],'Car Sales Mock'[Car Year],'Car  Sakes Mock'[Color])),
                                                  ,DESC,Dense)
 
As you can see below, the ranking works, even when slicing by different colors. 
Example 2.PNG
 
However, it breaks once we add in a filter for date as seen below.
 
Example 3.PNG
 
Would appreciate if anyone could help wiht the DAX for this, here are some other measures I have tried but don't work.
 
Avg Sale Price Rank - 2 = RANKX(ALLSELECTED('Car Sales Mock'),CALCULATE([Avg Sale Price]),,DESC,Dense)
Avg Sale Price Rank - 3 = RANKX(ALLSELECTED('Car Sales Mock'),CALCULATE([Avg Sale Price],ALLEXCEPT('Car Sales Mock','Car Sales Mock'[Car Make],'Car Sales Mock'[Car Year],'Car Sales Mock'[Color],'Calendar'[Date])),,DESC,Dense)
 
Avg Sale Price Rank - 4 = RANKX(ALLSELECTED('Car Sales Mock','Car Sales Mock'[Car Make],'Car Sales Mock'[Car Year],'Car Sales Mock'[Color]),CALCULATE([Avg Sale Price]),,DESC,Dense)
 
^ this one is close to working and was provided by another user, but there are duplicate rankings and a few errors
 
PBIX file if you want to take a look and try
 
 
Thanks, 
Much appreciated
2 REPLIES 2
lbendlin
Super User
Super User

 

Avg Sale Price Rank = RANKX(ALLSELECTED('Car Sales Mock'),CALCULATE([Avg Sale Price],ALLEXCEPT('Car Sales Mock','Car Sales Mock'[Car Make],'Car Sales Mock'[Color]),ALLEXCEPT('Calendar','Calendar'[Year],'Calendar'[Quarter],'Calendar'[Date])),,DESC,Dense)

 

Remove your Auto Date/Time stuff, it is not helpful.

 

Thanks for the tip, I removed it but unfortunately the measure still isn't working.

 

Any ideas on how I could rewrite the measure?

 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors