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
data4good
Frequent Visitor

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!!
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

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

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

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

Ahhh that's it! Thank you so much!

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.