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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

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

@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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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