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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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