Forum Discussion

data4good's avatar
data4good
Frequent Visitor
1 year ago
Solved

Help with error: DAX comparison operations

Hello,
 
I've been searching this forum for help, but haven't managed to find a solution to my problem. I am trying to create a calculated column called HMG. HMG should equal 1 only if both of the following conditions are met: SAMPLE =1 AND State_Clean = "WA". Otherwise, the value for HMG should equal 0. I'm using the following syntax and getting the following error:
 
HMG = if(    
    Interaction_Table[SAMPLE]=1 & RELATED(Client_Table[State_Clean])="WA",1,0)
 
ERROR: DAX comparison operations do not support comparing values of type Integer with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.
 
I would love some help adjusting my syntax to work. SAMPLE is a calculated column so I'm not sure how to tell what type it is, but I'm guessing it's numeric since the values are 1 and 0. I assume State_Clean is a string.
 
Thank you!!
  • the syntax for "and"  is &&  , not &   (which is a join operator)

2 Replies

  • the syntax for "and"  is &&  , not &   (which is a join operator)