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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MBWATSON
Helper II
Helper II

Function 'SWITCH' does not support comparing values of type True/False with values of type Text. Con

Hello! I am fairly new to Power BI and I have seen questions similar to mine but the answers aren't working to solve my issue. I have the following SWITCH statement

ROLE = SWITCH (
        TRUE (),
            '_VIB Report 2022 08 07'[STATUS CHANGED BY] = "DYER, HEIDI S" && '_VIB Report 2022 08 07'[DEPARTMENT] = "WILSONVILLE", "PCP", "VIB" ,
            '_VIB Report 2022 08 07'[STATUS CHANGED BY] = "MINGS, JENNIFER" && '_VIB Report 2022 08 07'[DEPARTMENT] = "TANASBOURNE", "PCP", "VIB",
            '_VIB Report 2022 08 07'[STATUS CHANGED BY] = "HOJNACKI, LAUREN A" && '_VIB Report 2022 08 07'[DEPARTMENT] = "GLISAN", "PCP", "VIB")  
 
It is returning this error messge
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.
 
The previous posts have shown text statements. Any help appreciated!
 
2 ACCEPTED SOLUTIONS

Unfortunately it is still throwing the same error.

View solution in original post

@MBWATSON 
Ok must be my mistake. Please try

ROLE =
VAR ChangedBy = '_VIB Report 2022 08 07'[STATUS CHANGED BY]
VAR Department = '_VIB Report 2022 08 07'[DEPARTMENT]
RETURN
    SWITCH (
        TRUE (),
        ChangedBy = "DYER, HEIDI S"
            && Department = "WILSONVILLE", "PCP",
        ChangedBy = "MINGS, JENNIFER"
            && Department = "TANASBOURNE", "PCP",
        ChangedBy = "HOJNACKI, LAUREN A"
            && Department = "GLISAN", "PCP",
        "VIB"
    )

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @MBWATSON 
Please try

ROLE =
SWITCH (
    VAR ChangedBy = '_VIB Report 2022 08 07'[STATUS CHANGED BY]
    VAR Department = '_VIB Report 2022 08 07'[DEPARTMENT]
    RETURN
        TRUE (),
    ChangedBy = "DYER, HEIDI S"
        && Department = "WILSONVILLE", "PCP",
    ChangedBy = "MINGS, JENNIFER"
        && Department = "TANASBOURNE", "PCP",
    ChangedBy = "HOJNACKI, LAUREN A"
        && Department = "GLISAN", "PCP",
    "VIB"
)

Now I am getting this error message

Failed to resolve name 'ChangedBy'. It is not a valid table, variable, or function name.

@MBWATSON 
Strange that this is a key word. However, try

ROLE =
SWITCH (
    VAR _ChangedBy = '_VIB Report 2022 08 07'[STATUS CHANGED BY]
    VAR _Department = '_VIB Report 2022 08 07'[DEPARTMENT]
    RETURN
        TRUE (),
    _ChangedBy = "DYER, HEIDI S"
        && _Department = "WILSONVILLE", "PCP",
    _ChangedBy = "MINGS, JENNIFER"
        && _Department = "TANASBOURNE", "PCP",
    _ChangedBy = "HOJNACKI, LAUREN A"
        && _Department = "GLISAN", "PCP",
    "VIB"

Unfortunately it is still throwing the same error.

@MBWATSON 
Ok must be my mistake. Please try

ROLE =
VAR ChangedBy = '_VIB Report 2022 08 07'[STATUS CHANGED BY]
VAR Department = '_VIB Report 2022 08 07'[DEPARTMENT]
RETURN
    SWITCH (
        TRUE (),
        ChangedBy = "DYER, HEIDI S"
            && Department = "WILSONVILLE", "PCP",
        ChangedBy = "MINGS, JENNIFER"
            && Department = "TANASBOURNE", "PCP",
        ChangedBy = "HOJNACKI, LAUREN A"
            && Department = "GLISAN", "PCP",
        "VIB"
    )

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.