Forum Discussion

im_newbie_123's avatar
im_newbie_123
Frequent Visitor
5 years ago

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

  • 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