Forum Discussion
CASE Statement replacement for DAX
- 3 years ago
Hi domtrump ,
I think Switch is what a lot of people use. If the calculations are cluttering up the formula, you might consider using variables to separate those from the switch statement- something like below:
Measure =
VAR ComplexCondition1 = longcomplexformula1
VAR ComplexResult2 = longcomplexformula2
RETURN
SWITCH ( TRUE (), [ComplexCondition1], [ComplexResult1] )etc...
Hi domtrump ,
I think Switch is what a lot of people use. If the calculations are cluttering up the formula, you might consider using variables to separate those from the switch statement- something like below:
Measure =
VAR ComplexCondition1 = longcomplexformula1
VAR ComplexResult2 = longcomplexformula2
RETURN
SWITCH ( TRUE (), [ComplexCondition1], [ComplexResult1] )
etc...
I did NOT know you could use FORMULAS in SWITCH! Awesome. Thanks so much. -Dom