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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
selpaqm
Helper V
Helper V

RANKX with SELECTEDVALUE

Hi,

 

I have a 6 different measure and want to use all of them on rankx with slicer. aim is creating a slicer with names of measures first then using selectedvalue and show top 10 figures on table.

I have created a table as figures and added measure names in to cells.

then created below dax but receiving error as "Special flag is not allowed as an argument number 3 of function 'RANKX'"

Top_10_Rating = 
Var
Selected=IF(SELECTEDVALUE(Figures[Figures])="aaa",[aaa],
IF(SELECTEDVALUE(Figures[Figures])="bbb",[bbb],
IF(SELECTEDVALUE(Figures[Figures])="ccc",[ccc],
IF(SELECTEDVALUE(Figures[Figures])="ddd",[ddd],
IF(SELECTEDVALUE(Figures[Figures])="eee",[eee],
IF(SELECTEDVALUE(Figures[Figures])="fff",[fff],BLANK()))))))
Var
mrank=RANKX(ALL(Table[Name]), Selected,desc)
return
IF(mrank<=10, Selected,BLANK())
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@selpaqm ,

 

Top_10_Rating = 
Var
Selected=IF(SELECTEDVALUE(Figures[Figures])="aaa",[aaa],
IF(SELECTEDVALUE(Figures[Figures])="bbb",[bbb],
IF(SELECTEDVALUE(Figures[Figures])="ccc",[ccc],
IF(SELECTEDVALUE(Figures[Figures])="ddd",[ddd],
IF(SELECTEDVALUE(Figures[Figures])="eee",[eee],
IF(SELECTEDVALUE(Figures[Figures])="fff",[fff],BLANK()))))))
Var
mrank=RANKX(ALL(Table[Name]), Selected,,desc)
return
IF(mrank<=10, Selected,BLANK())

 

One addition is required.

 

Also, my advice would create rank measures and then select then based on selection.

in place [aaa] use Rank on aaa in the formula

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@selpaqm ,

 

Top_10_Rating = 
Var
Selected=IF(SELECTEDVALUE(Figures[Figures])="aaa",[aaa],
IF(SELECTEDVALUE(Figures[Figures])="bbb",[bbb],
IF(SELECTEDVALUE(Figures[Figures])="ccc",[ccc],
IF(SELECTEDVALUE(Figures[Figures])="ddd",[ddd],
IF(SELECTEDVALUE(Figures[Figures])="eee",[eee],
IF(SELECTEDVALUE(Figures[Figures])="fff",[fff],BLANK()))))))
Var
mrank=RANKX(ALL(Table[Name]), Selected,,desc)
return
IF(mrank<=10, Selected,BLANK())

 

One addition is required.

 

Also, my advice would create rank measures and then select then based on selection.

in place [aaa] use Rank on aaa in the formula

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak can you give me an example becuase table gone crazy waiting ages to monitor one figure.

Just skipping one comma takes 1 hour. thanks @amitchandak 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.