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
StephenF
Responsive Resident
Responsive Resident

Getting RankX to work for two categories

Hi,

My Data looks like the following and I wish to generate a column as per the rightmost value in red based on clustering on two categories, category and client based on their sum spend.

 

StephenF_0-1652173646015.png

 

I require to be able to filter on columns that are hidden here, such as month and channel btw if that helps.

 

Tried this but no beuno.

 

Ranking by Sub Category =
    RANKX (
        FILTER(
            ALL(
                DataLake[MainCategory],
                DataLake[Client]
                ),
            DataLake[MainClashName]= MAX(DataLake[MainCategory])
            ),
            CALCULATE(SUM(DataLake[Spend]))
            )
 
I have had circular reference issues with other implementations of rankx too.
 

 

 

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@StephenF , Assume spend is a measure, Try like

Rankx(allexpect(Table, Table[Main Category], Table[Client]),[spend],,desc,dense)

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

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

I'm getting a circular reference error on creation of this measure?

 

Is there a way to diagnose this? Spend is made up of subtracting one calculated column from another btw.

 

PS: Using just some basic in table numeric field im getting the same circular reference warning.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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