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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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