Forum Discussion
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
- AnonymousNot applicable
Hard to exactly tell in that screenshot, any chance you can upload some sample data?
- DouweMeer
Impactful Individual
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] )RETURNif ( 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 )RETURNif (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 )- AnonymousNot 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.
- DouweMeer
Impactful Individual
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?