THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

SQLBI - Marco Russo

Please visit the same blog at - comments are now disabled here but you can comment on the new blog (all blog posts available here are available there, too).
You can follow me on Twitter: @marcorus

BLANK and Boolean functions like IF in #dax

A recent change in the DAX language transformed the behavior of IF statement, so that it should not return BLANK but only TRUE/FALSE if the results should be logical expressions. In that case, the BLANK is transformed in a FALSE condition.

For example, consider that the result of the following expression is FALSE and not BLANK:

IF ( 1 = 1, BLANK(), TRUE )

I wrote a longer explanation of that, thanks to Jeffrey Wang who provided the details of the implementation. Also a big thanks to Darren Gosbell, who raised the initial question.

Published Wednesday, September 14, 2016 1:04 PM by Marco Russo (SQLBI)
Filed under: , , ,



Jes Hansen said:

I would love to read the explanation, do you have a link to the explanation?

September 14, 2016 10:13 AM

Simon Nuss said:

To clarify: it should not return BLANK but only TRUE/FALSE if *one* of the results should be a logical expression?

I assume this is to ensure that TRUE/FALSE columns can contain only a true() or false(), and never a blank()?

September 14, 2016 12:00 PM

Marco Russo (SQLBI) said:

Jes: there was a missing link, now I fixed it - thanks!

Simon: yes, this is the idea, or at least it is close to. Please note that if you have a boolean and an integer, the result of IF is a variant, and it cannot be assigned to a calculated column (for example), unless you write an explicit cast. The case described is just for Boolean + BLANK in an IF.

September 14, 2016 12:43 PM
New Comments to this post are disabled

About Marco Russo (SQLBI)

Marco Russo is a consultant, writer and trainer specialized in Business Intelligence with Microsoft technologies. He runs the SQLBI.COM website, which is dedicated to distribute resources useful for BI developers, like Integration Services components, Analysis Services models, tools, technical information and so on. Marco is certified as MCT, MCDBA, MCSD.NET, MCSA, MCSE+I.

This Blog



Privacy Statement