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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.