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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.