Forum Discussion
heathernicole
Continued Contributor
10 years agoSWITCH statement in DAX using a "between this value and this value" as a filter?
VERY new to DAX - I think my issue is I haven't nailed down how to ask the right question yet - which hinders research for an answer: Trying to create an IF (or a Switch) statement If "this v...
asocorro
Skilled Sharer
10 years agoThe SWITCH statement allows comparisons with constants only. You need to use an IF statement. For a calculated column, this is an example:
Pop Classification =
IF(Population[Pop] >= 1000 && Population[Pop] <= 25000,
1,
IF(Population[Pop] >= 25001 && Population[Pop] <= 50000,
2,
0)
)
Pellegrino
3 years agoFrequent Visitor
This is no longer True (if it ever was) , using Switch can be used for ranges and not just descrete values.
Thus:
Total Amt Groups Using Switch = SWITCH(TRUE,Transactions[Total Amt]<2000,"Low",Transactions[Total Amt]>2000 && Transactions[Total Amt]<5000,"Medium","High")