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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
cchp07
Frequent Visitor

Power BI DAX Function 'SWITCH' does not support comparing values of type True/False

I am getting this error when I try to create a column in Power BI:


Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.


How do I fix this?


Here is the DAX for the column I am creating:


Status = SWITCH([G1TDTE] = "Null", "Plan", AND([G1DDTE] = "Null", [G1CDTE] = "Null"), "Undone Wip", [G1CDTE] = "Null", "Done Wip", "Finished")


The columns have the type text because I replaced values in query editor from 0 to "Null".

1 ACCEPTED SOLUTION
AnthonyTilley
Solution Sage
Solution Sage

is this a colunm or a measure 

 

if measure then you must use a max of the colunm values that you are comparing 

Status = 
SWITCH (
    TRUE(),
    MAX([G1TDTE]) = "Null", "Plan",
    AND ( max([G1DDTE]) = "Null", max([G1CDTE]) = "Null" ), "Undone Wip",
    max([G1CDTE]) = "Null", "Done Wip",
    "Finished"
)

for colunm no max need use the col ref as is 

 

Status_COL = 
SWITCH (
    TRUE(),
    [G1TDTE] = "Null", "Plan",
    AND ([G1DDTE] = "Null", [G1CDTE] = "Null" ), "Undone Wip",
    [G1CDTE] = "Null", "Done Wip",
    "Finished"
)

this only works if you have replaced you colunm with text colunms 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
AnthonyTilley
Solution Sage
Solution Sage

is this a colunm or a measure 

 

if measure then you must use a max of the colunm values that you are comparing 

Status = 
SWITCH (
    TRUE(),
    MAX([G1TDTE]) = "Null", "Plan",
    AND ( max([G1DDTE]) = "Null", max([G1CDTE]) = "Null" ), "Undone Wip",
    max([G1CDTE]) = "Null", "Done Wip",
    "Finished"
)

for colunm no max need use the col ref as is 

 

Status_COL = 
SWITCH (
    TRUE(),
    [G1TDTE] = "Null", "Plan",
    AND ([G1DDTE] = "Null", [G1CDTE] = "Null" ), "Undone Wip",
    [G1CDTE] = "Null", "Done Wip",
    "Finished"
)

this only works if you have replaced you colunm with text colunms 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




jdbuchanan71
Super User
Super User

Hello @cchp07 

I think it is just the first part of the SWITCH that is giving you trouble.  If we change it like so it should work.

Status =
SWITCH (
    TRUE (),
    [G1TDTE] = "Null", "Plan",
    AND ( [G1DDTE] = "Null", [G1CDTE] = "Null" ), "Undone Wip",
    [G1CDTE] = "Null", "Done Wip",
    "Finished"
)
  

 

@jdbuchanan71 

I get the same error when I try it that way. 

@cchp07 

Can you share a sample of the data in a format that can be copied (not a screen shot) or the .pbix file itself?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.