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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Anonymous
Not applicable

removing filter context for a switch formula

Hi all,

 

I have a sum measure and a RankX measure based on the Sum Measure. Now I want to create a measure which uses the output of the Rankx Measure to change this number in order to be able to create A podium visual with a bar chart. 

My data looks like this:

 

CategorySum of salesRankDesired measure result
A120033
B150012
C130021

 

So If the Rank = 1 then 2, IF rank =2 then 1, IF rank =3 then 3

I Tried to use the following formula but it returns only 2 probably because of the row filter context.

 SWITCH(
Rank,1,2,
 Rank,2,1,
Ranks,3,3))

 
Hope you can help me

 

1 ACCEPTED SOLUTION
tamerj1
Community Champion
Community Champion

@Anonymous 

It should work. Did you use correct syntax of SWITCH funtion?

should be 

SWITCH (

TEUE ( ),

Rank,1,2,
 Rank,2,1,
Ranks,3,3)

View solution in original post

2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

Measure = SWITCH([RANK],1,2,2,1,3)

CNENFRNL_0-1655901647663.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

tamerj1
Community Champion
Community Champion

@Anonymous 

It should work. Did you use correct syntax of SWITCH funtion?

should be 

SWITCH (

TEUE ( ),

Rank,1,2,
 Rank,2,1,
Ranks,3,3)

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.