Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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?
Solved! Go to Solution.
=
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"
)
Here is the Code.
=
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"
)
It works. Thanks alot
Hi @prasad393
you need to use SWITCH over TRUE( )
SWITCH (
TRUE ( ),
codition1, result if condition 1 is ture,
codition2, result if condition 2 is ture,
.
.
.
)
I used SWITH over TRUE(). I still get the error.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
9 | |
8 | |
8 | |
8 |
User | Count |
---|---|
14 | |
12 | |
11 | |
10 | |
9 |