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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

RankX DAX Help

Hello,

 

Trying to get RANKX to rank a list of results. The relevent tables are structured like this: one customer table is related to a sales documents table. The relationship is one to many from the customer table to the sales documents table. The sales documents table is filtered by date and the customer table is filtered by salesperson using slicers in the report context.

 

The listed values are "KG" in the sales documents table. I have 10 resulting customers for a particular time range. However, I have 15 customers in the customer table. This is my syntax:

 

Sale KG Rank = RANKX(ALLSELECTED(Customer), CALCULATE(sum('Sales Documents'[KG])))
 
This formula works well except it also shows customers who have blank KG (the ones with no sales in the selected time period). This means that when I sort the measure column in descending sequence, it shows the 5 customers without any sales, ranked last in a tie.
 
How do I filter the customer table to only result in a rank number when there are sales in the current filter context?
 
Thanks
Michael
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

1 REPLY 1
amitchandak
Super User
Super User

Refer, if this can help

https://community.powerbi.com/t5/Desktop/RANKX-excluding-blanks/td-p/396044

For rank related ref

https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.