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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Kiran1407
New Member

Ranking Logic not working as expected when filters are applied

Hi Everyone,

Am a newbie to PowerBI. I came across a scenario where my "Ranking" Column is not working as expected in my original dashboard. I tried to recreate the same scenario with some dummy data as shown in the snippets.

Snippet 1: Base table "Table" showing the data for certain fields, Country, City, Place, Cat Type and Continent.

Kiran1407_3-1684427827200.png

 

 

Snippet 2:  New Table "Slicer Table" - created using UNION of selected columns from Base Table - "Table".

Kiran1407_2-1684427795051.png

 

Kiran1407_6-1684429968558.png

 

* Logic for Value(Dynamic) - Measure in Table is:

Value (Dynamic) =
VAR CategorySelection = SELECTEDVALUE(SlicerTable[Selection], "City")
RETURN
SWITCH(
    TRUE(),
    CategorySelection = "Country", CALCULATE(sum('Table'[Value]), TREATAS(VALUES(SlicerTable[Category]), 'Table'[Country])),
    CategorySelection = "City", CALCULATE(sum('Table'[Value]), TREATAS(VALUES(SlicerTable[Category]), 'Table'[City])),
    CategorySelection = "Place", CALCULATE(sum('Table'[Value]), TREATAS(VALUES(SlicerTable[Category]), 'Table'[Place]))
   
)



*Logic for Ranking - Calculated Column in Slicer Table is:

Ranking =
VAR CurrentSelection = SlicerTable[Selection]
RETURN
RANKX(
    FILTER(SlicerTable, SlicerTable[Selection] = CurrentSelection),
    SlicerTable[Total],,DESC
)

- Merged 3 different categories (City, County and Place) to act as a single Slicer and rows for Category Column changes as per the choice in selection slicer. Now when i tried to keep filters (continent,Cat Type) from "Table" to this page - my ranking logic is not working as expected in my original report where as its working fine in the below snippet with dummy data.

 

Kiran1407_5-1684429170837.png

 

My Objective: Ranking logic should work as expected and provide the consistent descending order, even if we select any filters from "Table" on the above Graph. 
In my original file, i used  Ranking with descending order, the values will be consistent for few rows and the sequence gets messed up in between. Can anyone please help me out?

 

 

 

0 REPLIES 0

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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.