Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analyis to replace isnull

I have been on a crusade to eliminate if statements in expressions.

I have the below statement that I don't know if Set would help.

If anyone has thoughts I would appreciate it.

Sum ([ A ]) - sum(if(IsNull([ B] ),[ C ],[ B ]))

Basically this subtracts B from A unless B is null then is uses C

1 Reply
Not applicable
Author

Hi pshicks,

I tried this:


(isnull(B)*-1)*C + (isnull(B)+1)*B


But if B is null you can't calculate with it: x+null = null

You only can calculate with independent Values:


(isnull(A)*-1)*C + (isnull(A)+1)*B


This means if A is Null sum(C) else sum(B)



Have Fun

Alex:)