Forum Discussion
Anonymous
6 years agoNot applicable
DAX SWITCH STATEMENT not working properly
Hello, I am just trying to make a mesure by using SWITCH statement. but it is not working properly. I don't know why. Here is my code. I feel like there is something wrong with SWITCH statement be...
- 6 years ago
Hi Anonymous ,
Based on my test and reasearch, I have added a filter in your [Construction Income (Budget)] measure and now it can show the correct result:
Construction Income (Budget) = CALCULATE(SUM('Budget For Meters'[Budget]), FILTER(ALL('Budget For Meters'),'Budget For Meters'[Description] = "1.Construction Income"))Attached the modifed dummy file, please check it: Dummy.pbix
Best Regards,
Yingjie LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
Super User
6 years agouse daxformatter.com to put your formula into a readable format, and maybe find out where your logic breaks down.
- Anonymous6 years agoNot applicable
Here you go.
- lbendlin6 years ago
Super User
here's how SWITCH() is supposed to work for your scenario (there are other options too)
SWITCH( TRUE(),<first test>,"first result",<second test>,"second result",...,"alternative result")
- Anonymous6 years agoNot applicable
Actually, I gave you wrong code. This is right one.