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
sangjinhong
Regular Visitor

The doubt about IF in DAX when there is a boolean expression as result

I authored a query with two IF statements where I used two boolean expressions respectively as condition and result, to my surprised, the value2 returned a "Flase" when I think it should be BLANK().  When I put the BLANK() in the 3rd parameter as value1, the it gets a right result "True".

the code is here: https://dax.do/d1lbobLn8I35w4/

 

can anyone explain what's happening inside DAX? thanks a lot

 

 

 

sangjinhong_2-1628722937861.png

 

 

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @sangjinhong 

 

The short answer is that BLANK() is not an allowed value for any expression that is cast as Boolean type, and will automatically be converted to false.

 

With your two sample expressions, they are both cast as Boolean since one of the branches of IF returns a Boolean.

You can also demonstrate the behaviour with this query:

 

EVALUATE
{ CONVERT ( BLANK (), BOOLEAN ) }

 

 

Check out this article, specifically the section "Handling BLANK in Boolean expressions".

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

1 REPLY 1
OwenAuger
Super User
Super User

Hi @sangjinhong 

 

The short answer is that BLANK() is not an allowed value for any expression that is cast as Boolean type, and will automatically be converted to false.

 

With your two sample expressions, they are both cast as Boolean since one of the branches of IF returns a Boolean.

You can also demonstrate the behaviour with this query:

 

EVALUATE
{ CONVERT ( BLANK (), BOOLEAN ) }

 

 

Check out this article, specifically the section "Handling BLANK in Boolean expressions".

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

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.

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.