Reply
jayasurya_prud
Helper II
Helper II
Partially syndicated - Outbound

DAX - Switch Function with What if Scenarios

Hi! I am working on a report, which I am creating multiple what if scenarios. 

In that, I am creating 3 what if Scenario. 

 

1A - Whole Number

2B - Whole Number

2C - Fixed Decimal - Conversion Rate  - 2B & 2C are to be expected to work together.

 

jayasurya_prud_0-1675250542199.png

 

Now, If I slice 1A as 500 - The Result should show as 500

 

If I want to use the combo of 2B and 2C (2B = 500, 2C = 10%) it should overwrite the 1A result of 500 and show 50. 

 

For this I am using Switch Function, 
-------------------------------------------------------------------

SWITCH(
SELECTEDVALUE('1A'[1A]),'1A'[1A Value],
SELECTEDVALUE('2B'[2B]),'Measure'[2a_2b])
 
--------------------------------------------------------------------
The 'Measure'[2a_2b] = 
 
var x = SELECTEDVALUE('2A'[2A])

return x*'2B'[2B Value]
 
---------------------------------------------------------------------------
 
I am not getting the expected results. I think I miss somewhere in Expression in Swithc DAX
 
If I slice 1A - no reaction. 
 

If I slice 2A as 100, I am getting 100 as result. But the Expected result is 0 as the 2B is 0%. The 2B is not playing part in it.

Please help me for the solution.

1 REPLY 1
v-rzhou-msft
Community Support
Community Support

Syndicated - Outbound

Hi @jayasurya_prud ,

 

 

If I slice 2A as 100, I am getting 100 as result. But the Expected result is 0 as the 2B is 0%. The 2B is not playing part in it.

 

I couldn't find 2A in your screenshot and I think 2C should be in percentage data type and 2B should be in number type.

So I guess Measure''[2a_2b] ' may be 2C*2B.

Measure = 
IF(ISFILTERED('2B'[2B])||ISFILTERED('2C'[2C]),[2B Value] * [2C Value] ,[1A Value])+0

RicoZhou_0-1675328841439.png

RicoZhou_0-1675328958773.png

If this reply still couldn't help you solve your issue, please show me more details. You can share a sample file with me and show me a screenshot with the result you want.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)