cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Post Prodigy

## Why is my boolean not working?

I just don't get it. It is boolean like :

and  () , || and () , || and () , || and ()

...and it keep telling me the answer is false. But in red I marked where it should be a True value. As the rest is OR, it should give me True, thus the number 1. I don't get it why it won't give me 1. Anyone?

5 REPLIES 5
Anonymous
Not applicable

Hard to exactly tell in that screenshot, any chance you can upload some sample data?

Post Prodigy

Just found out what is happening. When the field is set as a number and the value for the field is a 0, than the boolean expression will state that the field with the value of 0 is both blank() as it is 0.

You can recreate it by 'enter data', get Column1 on value 0. Then go to the table and enter the if statement:

if ( [column1] = blank() , 1 , 0 ). It will return the value 1. Now change the blank() in the if statement to a 0, and once again, it will return 1.

I don't find the logical. Is this a bug?

Post Prodigy

Nope. What I can do, the [Psoft invoice1] has the expression :

Psoft Invoice1 =
VAR a1 = [Invoice 1]
VAR a2 = SELECTCOLUMNS( filter ( 'Psoft' , CONTAINSSTRING( a1 , 'Psoft'[Invoice] )) , "Trans" , 'Psoft'[Transactional amount] )
RETURN
if ( a1 = BLANK() , BLANK() , if ( countx ( a2 , [Trans] ) > 0 , sumx ( a2 , [Trans] ) , 0 ) )

And the full expression of the print screen is :

Psoft Value2 =
VAR a1 = [Equation1]
VAR a2 = [Equation2]
VAR a3 = [Equation3]
VAR e4 = if ( [Equation1] = BLANK() && [Equation2] = BLANK() && [Equation3] = BLANK() , [Psoft Invoice1] , 4 )
VAR e3 = if ( and ( ( [Equation1] = 1 || [Equation1] = 3 || [Equation1] = 4 ) , ( [Equation2] = BLANK() && [Equation3] = BLANK() ) ) , [Psoft Invoice1] + [Psoft Invoice2] , e4 )
VAR e2 = if ( a2 = 5 || a2 = 6 , [Psoft Invoice3] , e3 )
VAR e1 = if ( a3 = 5 || a3 = 6 , [Psoft Invoice4] , e2 )
RETURN
if (
and ( [Psoft Invoice1] = 0 , [Psoft Invoice1] <> BLANK() )
|| and ( [Psoft Invoice2] = 0 , [Psoft Invoice2] <> BLANK() )
|| and ( [Psoft Invoice3] = 0 , [Psoft Invoice3] <> BLANK() )
|| and ( [Psoft Invoice4] = 0 , [Psoft Invoice4] <> BLANK() )
, 1
, e1 )

Anonymous
Not applicable

It probably has to do with the variables. Variables are calculated where you define them, not when you use them. Try without using variables. Also, might want to use SWITCH instead, generally easier to use.

Post Prodigy

Myea, have to start using Switch. Regarding the 0, I received the following message from a moderator.

The same issue has been reported before internally: CRI 88868161.

"In DAX, the comparison operator = performs equivalence comparison. Since 0 and BLANK are equivalent values, operator = returns true when comparing 0 to BLANK. Users can use DAX function IsBlank to detect BLANK values."

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.