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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
BeastHouse
Frequent Visitor

IF/OR Formula Help

Hi, trying to calculate an exchange rate used in a procurement data set. The below formula is throwing the error DAX comparison operations do not support comparing values of type Number with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

 

The data being calculated is formatted as a Decimal Number. There are blanks in the data, so I think the error is being thrown over the first part of the OR. 


Any help would be greatly appreciated.

 

Exchange Rate = IF(OR('Stock Orders'[Exchange Rate For Report Estimates]="",'Stock Orders'[Exchange Rate For Report Estimates]=0),1,'Stock Orders'[Exchange Rate For Report Estimates])

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @BeastHouse 

try like:

Exchange Rate =
IF(
'Stock Orders'[Exchange Rate For Report Estimates]=0,
1,
'Stock Orders'[Exchange Rate For Report Estimates]
)
 
DAX take 0 and blank as the same.

View solution in original post

4 REPLIES 4
FreemanZ
Super User
Super User

hi @BeastHouse 

try like:

Exchange Rate =
IF(
'Stock Orders'[Exchange Rate For Report Estimates]=0,
1,
'Stock Orders'[Exchange Rate For Report Estimates]
)
 
DAX take 0 and blank as the same.

I also have this one, similar situation. 

From Excel:

 

=IF(AND([@[PO/Credit Check]]="TRUE",[@[Invoice Finalised]]=FALSE),([@[Quoted Amount]]/[@[Exchange Rate]])-[@[Invoice Amount]],0)

 

I tried the following in Power BI

PO Outstanding = IF('Stock Orders'[PO/Credit Check]="TRUE"&&'Stock Orders'[Invoice Finalised]="FALSE",'Stock Orders'[Quoted Amount]/'Stock Orders'[Exchange Rate]-'Stock Orders'[Invoice Amount],0)

 

But still get DAX comparison operations do not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values. I have also tried with an AND statement but same result.

I think this could be the simple way of going about it! I am trying to transfer from Excel to Power Bi, so struggle with translating some of the formulas in the existing database. Thanks a lot.

ValtteriN
Super User
Super User

Hi,

The issue is this part of your dax:

'Stock Orders'[Exchange Rate For Report Estimates]=""

Example and solution:

This won't work:

Measure 38 = IF(MAX('Table (21)'[Column1])="",1,0)
 
ValtteriN_1-1675680247079.png

ValtteriN_0-1675679970911.png

This will work:

Measure 38 = IF(ISBLANK(MAX('Table (21)'[Column1])),1,0)

ValtteriN_2-1675680311031.png
So in Short use ISBLANK to solve the issue.

 

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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