Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
prasad393
Frequent Visitor

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?

 

prasad393_0-1694720847363.png

@Greg_Deckler,@Vijay_A_Verma 

1 ACCEPTED SOLUTION

@prasad393 

=
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"
)

View solution in original post

6 REPLIES 6
prasad393
Frequent 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"
)

@prasad393 

=
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

tamerj1
Super User
Super User

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.

@prasad393 

Please paste your code over here

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.