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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
im_newbie_123
Frequent Visitor

DAX Switch statement error

Column1 = SWITCH(True(),[ID] = "FH20-10","YES",[ID] = "FA30-10","YES",[ID] = "FA60-20","YES","NO")

 

I am trying to create a caluclated column named "Column1" and is getting this error :

 

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.

 

Any help would be highly appreciated.

 

Thanks in advance

1 REPLY 1
Fowmy
Super User
Super User

@im_newbie_123 

It seems your column [ID] returns a nontext value and you are comparing with text. You can convert to the text value and do the SWTICHCH like

Column1 = 
VAR X = FORMAT([ID],"@") RETURN
SWITCH(True(),
 X = "FH20-10","YES",
 X = "FA30-10","YES",
 X = "FA60-20","YES",
 "NO"
)

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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