Forum Discussion
Calculated column using switch
- Anonymous2 years ago
Hi wyller ,
Thanks tackytechtom for sharing, I have something to add here as well.
Is Dax's error message of the following form:
Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
You can try using the following dax.
Aging2 = VAR _daycount = DATEDIFF([Created], TODAY(), DAY) RETURN SWITCH( [CurrentStatus] IN{ "In Process", "In Review", "Pending", "Submitted"}, _daycount <= 30, "0-30 days old", _daycount > 31 && _daycount <=60, "31-60 days old", _daycount > 61 && _daycount <=90, "61-90 days old", "Lifetime" )Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi wyller ,
Thanks tackytechtom for sharing, I have something to add here as well.
Is Dax's error message of the following form:
Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
You can try using the following dax.
Aging2 =
VAR _daycount = DATEDIFF([Created], TODAY(), DAY)
RETURN
SWITCH(
[CurrentStatus] IN{ "In Process", "In Review", "Pending", "Submitted"},
_daycount <= 30, "0-30 days old",
_daycount > 31 && _daycount <=60, "31-60 days old",
_daycount > 61 && _daycount <=90, "61-90 days old",
"Lifetime"
)
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.