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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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