Forum Discussion
Function 'SWITCH' does not support comparing values of type Text with values of type True/False.
Hello Folks,
I am fairly new to DAX.
Below is the DAX statement. When I write this I get an error message as BELOW
"Function 'SWITCH' does not support comparing values of type Text with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values."
How can I fix the issue?
=
SWITCH (
TRUE (),
TENT_OVERVIEW[DBA] = "Vacant", "VACANT UNIT",
TENT_OVERVIEW[LEASE_END_DATE] <= DATE ( 2024, 12, 31 ), "Expiration through 12-31-2024",
TENT_OVERVIEW[LEASE_END_DATE] > DATE ( 2024, 12, 31 ), "Expiration After 12-31-2024",
TENT_OVERVIEW[KICKOUT_EXERCISE_START_DATE] <= DATE ( 2024, 12, 31 ), "Kick Out Through 12-31-2024",
TENT_OVERVIEW[KICKOUT_EXERCISE_START_DATE] > DATE ( 2024, 12, 31 ), "Kick Out After 12-31-2024"
)
6 Replies
- prasad393Frequent Visitor
Here is the Code.
SWITCH (TRUE (),TENT_OVERVIEW[DBA], "Vacant", "VACANT UNIT",( TENT_OVERVIEW[LEASE_END_DATE] ) <= 12 / 31 / 2024, "Expiration through 12-31-2024",( TENT_OVERVIEW[LEASE_END_DATE] ) > 12 / 31 / 2024, "Expiration After 12-31-2024",( TENT_OVERVIEW[KICKOUT_EXERCISE_START_DATE] ) <= 20241231, "Kick Out Through 12-31-2024",( TENT_OVERVIEW[KICKOUT_EXERCISE_START_DATE] ) > 20241231, "Kick Out After 12-31-2024")- tamerj1Community Champion
=
SWITCH (
TRUE (),
TENT_OVERVIEW[DBA] = "Vacant", "VACANT UNIT",
TENT_OVERVIEW[LEASE_END_DATE] <= DATE ( 2024, 12, 31 ), "Expiration through 12-31-2024",
TENT_OVERVIEW[LEASE_END_DATE] > DATE ( 2024, 12, 31 ), "Expiration After 12-31-2024",
TENT_OVERVIEW[KICKOUT_EXERCISE_START_DATE] <= DATE ( 2024, 12, 31 ), "Kick Out Through 12-31-2024",
TENT_OVERVIEW[KICKOUT_EXERCISE_START_DATE] > DATE ( 2024, 12, 31 ), "Kick Out After 12-31-2024"
)- prasad393Frequent Visitor
It works. Thanks alot