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
thedocs
Helper I
Helper I

RANKX DAX Problem adding Column removes filter

 

I have a problem I am stuck with and have a the pbix file attached. In report (below image) shows 3 columns. 

 

Report Link pbix file 

 

 

All customer Leads: Displays all 21 customers and a count of the qty Leads each has (no filter)

Top 10 Customers: Displays top 10 customers by qty Leads (correctly) using RANKX

Top 10 Customers (Inc Status): Displays top 19 customers (incorrect should also be 10) after I added the status field

 

thedocs_1-1690367490745.png

 
countleadid = COUNTX('Leads','Leads'[Leadid])
 
Rank Top 10 =
CALCULATE(
    [countleadid],
    FILTER(
        VALUES( 'Leads'[Customer Name] ),
        RANKXALL( 'Leads'[Customer Name] ),
        [countleadid], , DESC ) <=10 )
        )
 
Required Outcome:

I would like to see in the 'Top 10 Customers (Inc Status)' table only the Top 10 customers (not 19) when the status colum is included. Example Customer D is not a top 10 customer and yet appears when Status is added.

 

Any help greatly appreciated as am totally stuck on this now and have tried the forum and cant see anything that replicates this at all.

 

 

 

1 ACCEPTED SOLUTION
thedocs
Helper I
Helper I

Found Solution

 

Step 1: Replace DAX with below:

Rank Top 10 =
    RANKX(ALL( 'Leads'[Customer Name] ),CALCULATE([countleadid],ALL('Leads'[Status]) ), ,DESC)
 
Step 2: 
Remove Filter remove blanks
 
Step 3:
Add Filter on Rank Top 10 Top (10 >=1)

View solution in original post

3 REPLIES 3
thedocs
Helper I
Helper I

Found Solution

 

Step 1: Replace DAX with below:

Rank Top 10 =
    RANKX(ALL( 'Leads'[Customer Name] ),CALCULATE([countleadid],ALL('Leads'[Status]) ), ,DESC)
 
Step 2: 
Remove Filter remove blanks
 
Step 3:
Add Filter on Rank Top 10 Top (10 >=1)
thedocs
Helper I
Helper I

Hi @AllisonKennedy  would u mind having a look at this issue? You posted a brilliant solution to a similar issue problem but I just cant seem to transfer that to the solution I need.

 

https://community.fabric.microsoft.com/t5/Desktop/RANKX-with-multiple-FILTER/td-p/2266250

 

If you could have a quick look I would be very grateful as been stuck on this for a few days now 😞

 

Connor

thedocs
Helper I
Helper I

I have DAX included below:

 

countleadid = COUNTX('Leads','Leads'[Leadid])
 
Rank Top 10 =
CALCULATE(
    [countleadid],
    FILTER(
        VALUES( 'Leads'[Customer Name] ),
        RANKX( ALL( 'Leads'[Customer Name] ),
        [countleadid], , DESC ) <=10 )
        )

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
Top Kudoed Authors