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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
haidong
New Member

DAX comparison operations do not support comparing values of type Text with values of type Integer

I got error message with this fomular :

 

if('GI_Yield Feb20'[Item_N]="no",'GI_Yield Feb20'[Qty in unit of entry]/2,'GI_Yield Feb20'[Qty in unit of entry]
 
I have confirmed the data type of[Item_N] is text , just can't figure why = " no" doesn't work. 
 
where should I check futher?
Can anyone help?
Thanks very much.
1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @haidong ,

 

I think there may be spaces in the item_n column.

You can try the DAX below:

Column =
IF (
    SEARCH ( "no", 'GI_Yield Feb20'[Item_N], 1, 0 ) > 0,
    'GI_Yield Feb20'[Qty in unit of entry] / 2,
    'GI_Yield Feb20'[Qty in unit of entry]
)

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @haidong ,

 

I think there may be spaces in the item_n column.

You can try the DAX below:

Column =
IF (
    SEARCH ( "no", 'GI_Yield Feb20'[Item_N], 1, 0 ) > 0,
    'GI_Yield Feb20'[Qty in unit of entry] / 2,
    'GI_Yield Feb20'[Qty in unit of entry]
)

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

Try like this nad check

 

if('GI_Yield Feb20'[Item_N] & ""="no",'GI_Yield Feb20'[Qty in unit of entry]/2,'GI_Yield Feb20'[Qty in unit of entry]

 

Make sure data type changed here

Data Format.pngDatatype in new ribbion.png

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi

i m trying to extract first X digits out of my ID column of data as

 

Match-ID = IF('ATL-270524'[NTN-FBR] = 9, LEFT('ATL-270524'[NTN-FBR], 7), LEFT('ATL-270524'[NTN-FBR], 11))
but this resulted in error as "DAX comparison operations do not support comparing values of type Text with values of type Integer. Consider using the VALUE or FORMAT function to convert one of the values."
 
basically the field "NTN-FBR" is having digits plus "-" dash in few cases that is why i've kept data type of this field as "TEXT"
 
kindly guide ASAP.
az38
Community Champion
Community Champion

Hi @haidong 

First of all heck it in Power Query Editor mode (if available)

or you can debug issue with ISTEXT() function

The statement

Column = ISTEXT('GI_Yield Feb20'[Item_N])

should return you true if the field is exactly Text


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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