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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

RANKX on Field Parameter returns all 1

I wanted to sort my bar chart with Fieldparameter for one axis on the values, but that keeps resetting when switching between my KPIs. So I tried to instead create a RANK measure, and add it to the tooltip instead. However I'm stuck with the measure returning all rows as Rank 1. 

 

When I return the selected value (_Value below) it matches correctly the actual value, so It must be something I'm doing wrong with the RANKX function... 

 

VAR _Selected = SELECTCOLUMNS(SUMMARIZE( 'Parameter','Parameter'[Parameter],'Parameter'[Parameter Fields]), "Parameter", 'Parameter'[Parameter])
VAR _Selected2 = IF(COUNTROWS(_Selected),_Selected)

VAR _Value = SWITCH(
    TRUE(),
        _Selected2 = "Measure1 %", [Measure1 avg %],
        _Selected2 = "Measure2 %", [Measure2 avg %],
        _Selected2 = "Measure3 %", [Measure3 avg %],
        _Selected2 = "Measure4 %", [Measure4 avg %],
        _Selected2 = "Measure5 %", [Measure5],
        _Selected2 = "Measure6", [Measure6],
        _Selected2 ="Measure7", [Measure7])

VAR _RANK = RANKX(ALL(Store[StoreName]), _Value, ,DESC,Dense)
RETURN
_RANK

Any suggestions? thanks

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@pankajnamekar25 

Thanks for the response, 

I decided to just sort on the _Value variable instead. Gave me the desired result

View solution in original post

2 REPLIES 2
pankajnamekar25
Memorable Member
Memorable Member

Hello @Anonymous 

 

this solution will not work with feild paramter , I had similar reuriment in one of my project.

 

I connected different page for each metric and slicer user disconnected table and loop that table in rankx measue

Unpivot the Task Columns

Select the Project column.

Go to the ribbon: Transform → Unpivot Other Columns.

 

Thanks,
 Pankaj Namekar | LinkedIn

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

Anonymous
Not applicable

@pankajnamekar25 

Thanks for the response, 

I decided to just sort on the _Value variable instead. Gave me the desired result

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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