The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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
Solved! Go to Solution.
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
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
User | Count |
---|---|
15 | |
12 | |
7 | |
6 | |
5 |
User | Count |
---|---|
24 | |
20 | |
12 | |
9 | |
7 |