1

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 Answer 1

1

A DAX measure can only return a single data type, not a string sometimes and a boolean sometimes. You can use the FORMAT function to turn a boolean into text:

Status =
SWITCH (
    [G1TDTE] = "Null",
    "Plan", FORMAT ( AND ( [G1DDTE] = "Null", [G1CDTE] = "Null" ), "True/False" ),
    "Undone Wip", [G1CDTE] = "Null",
    "Done Wip", "Finished"
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.