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

Win a FREE 3 Day Ticket to FabCon Vienna. Apply now

Reply
Traceout
Frequent Visitor

DAX comparison operations do not support comparing values of type Integer with values of type T/F

I'm getting the following error when creating a new column:
 
DAX comparison operations do not support comparing values of type Integer with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values.
 
'TEMP STATES' DEVCAT is a whole number data type
TEMP STATES - DEVICE is text
 
Any help would be appreciated. 
 
DEVCAT SWITCH =
SWITCH (
    TRUE (),
    ISERROR ( FIND ( "84", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "SECTIONALIZER",
    ISERROR ( FIND ( "4", 'TEMP STATES - ALL'[DEVCAT]) ) && FIND ( "SC_", 'TEMP STATES - ALL'[DEVICE] ) <> TRUE (), "SECTIONALIZER",
    ISERROR ( FIND ( "4", 'TEMP STATES - ALL'[DEVCAT]) ) && FIND ( "SW_", 'TEMP STATES - ALL'[DEVICE] ) <> TRUE (), "SWITCH",
    ISERROR ( FIND ( "4", 'TEMP STATES - ALL'[DEVCAT]) ) && FIND ( "_CB", 'TEMP STATES - ALL'[DEVICE] ) <> TRUE (), "FEEDER",
    ISERROR ( FIND ( "4", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "SWITCH",
    ISERROR ( FIND ( "18", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "FUSE",
    ISERROR ( FIND ( "8", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "SERVICE TRANSFORMER",
    ISERROR ( FIND ( "19", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "RECLOSER",
    ISERROR ( FIND ( "21", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "RECLOSER",
    ISERROR ( FIND ( "26", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "LINECUT",
    ISERROR ( FIND ( "92", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "SERVICE",
    ISERROR ( FIND ( "9", 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (), "TRANSMISSION",
    ISERROR ( FIND ( BLANK(), 'TEMP STATES - ALL'[DEVCAT]) ) <> TRUE (),  "BLANK",
    "REPORT"
)
1 ACCEPTED SOLUTION
Gabry
Super User
Super User

Hello,

I don't think it can work like that. Try this:

 

DEVCAT SWITCH =
SWITCH (
TRUE(),
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "84"), "SECTIONALIZER",

AND(
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"),
CONTAINSSTRING('TEMP STATES - ALL'[DEVICE], "SC_")
), "SECTIONALIZER",

AND(
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"),
CONTAINSSTRING('TEMP STATES - ALL'[DEVICE], "SW_")
), "SWITCH",

AND(
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"),
CONTAINSSTRING('TEMP STATES - ALL'[DEVICE], "_CB")
), "FEEDER",

CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"), "SWITCH",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "18"), "FUSE",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "8"), "SERVICE TRANSFORMER",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "19"), "RECLOSER",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "21"), "RECLOSER",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "26"), "LINECUT",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "92"), "SERVICE",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "9"), "TRANSMISSION",

ISBLANK('TEMP STATES - ALL'[DEVCAT]), "BLANK",

"REPORT"
)

View solution in original post

2 REPLIES 2
Gabry
Super User
Super User

Hello,

I don't think it can work like that. Try this:

 

DEVCAT SWITCH =
SWITCH (
TRUE(),
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "84"), "SECTIONALIZER",

AND(
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"),
CONTAINSSTRING('TEMP STATES - ALL'[DEVICE], "SC_")
), "SECTIONALIZER",

AND(
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"),
CONTAINSSTRING('TEMP STATES - ALL'[DEVICE], "SW_")
), "SWITCH",

AND(
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"),
CONTAINSSTRING('TEMP STATES - ALL'[DEVICE], "_CB")
), "FEEDER",

CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "4"), "SWITCH",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "18"), "FUSE",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "8"), "SERVICE TRANSFORMER",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "19"), "RECLOSER",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "21"), "RECLOSER",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "26"), "LINECUT",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "92"), "SERVICE",
CONTAINSSTRING('TEMP STATES - ALL'[DEVCAT], "9"), "TRANSMISSION",

ISBLANK('TEMP STATES - ALL'[DEVCAT]), "BLANK",

"REPORT"
)

Worked like a charm. Thank you.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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