The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Hi Everyone,
Im in need of help converting the below case statements to dax.
Case
WHEN ([SCODE]) = 47123
THEN((([Total Actual]+1350)+Case when isnull([Total Budget_Food]) then (-1*[Total Budget]) else [Total Budget_Food] END)/[Total ComparedOcc_FB]*[Max Negation])/((Case when isnull([Total Budget_Food]) then (-1*[Total Budget]) else [Total Budget_Food] END)/[Total Compared_Occ_FB])
ELSE(([Total Actual]+Case when isnull([Total Budget_Food]) then (-1*[Total Budget]) else [Total Budget_Food] END)/[Total Compared_Occ_FB]*[Max Negation])/((Case when isnull([Total Budget_Food]) then (-1*[Total Budget]) else [Total Budget_Food] END)/[Total Compared_Occ_FB])
END
Your assistance will be much appreciated.
Solved! Go to Solution.
@Anonymous , You can use Switch with True
example
Switch(True() ,
[SCODE]) = 47123 , [Total Actual]+1350 ,
isblank([Total Budget_Food]) , -1*[Total Budget],
divide([Total Budget_Food] END), [Total ComparedOcc_FB]*[Max Negation])
)
same way you can add another switch true
Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56
Hi @Anonymous,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
@Anonymous , You can use Switch with True
example
Switch(True() ,
[SCODE]) = 47123 , [Total Actual]+1350 ,
isblank([Total Budget_Food]) , -1*[Total Budget],
divide([Total Budget_Food] END), [Total ComparedOcc_FB]*[Max Negation])
)
same way you can add another switch true
Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56
User | Count |
---|---|
65 | |
60 | |
55 | |
54 | |
31 |
User | Count |
---|---|
180 | |
88 | |
70 | |
46 | |
45 |