Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to write expression to get values


Hi,

I have to use Sum(Commision) in staright table but oit contains some NULL values

how to write expression to skip null values i,e to replace NULL with zero.

Thanks.

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Well, if I understood correctly, sum(Commission) should be enough, summing all numeric values (and NULL is not a value).

You probably ask for something like

=sum(if (not isnull(Commission), Commission,0))

but I don't think that returns something different than just sum(Commission).

View solution in original post

8 Replies
swuehl
Champion III
Champion III

You mean field Commission contain NULLs?

I think what you want is the default behaviour of sum(), what do you observe?

Not applicable
Author

Yes filed commision has Null values

so, I need to use ISNULL function . can you please send me the expression how to use ISNULL

swuehl
Champion III
Champion III

Well, if I understood correctly, sum(Commission) should be enough, summing all numeric values (and NULL is not a value).

You probably ask for something like

=sum(if (not isnull(Commission), Commission,0))

but I don't think that returns something different than just sum(Commission).

Not applicable
Author

Well you could also 'fix' your Nulls in the load script in a similar manner and thereby avoid worrying about it at the expression stage. Thus you could write something along the lines of:

Assuming your load script looks similar to this now:

LOAD

Commission

FROM ...

You could try doing this instead:

LOAD

If(IsNull(Commission,0,Commission) as Commission

FROM ...

// the logic of the above is if the value of Commission field = Null then let its value be 0, otherwise just use whatever value Commission field already has.

Not applicable
Author

Thanks and I suppose I should have use

sum(if ( isnull(Commision),0, Commision))

Not applicable
Author

Well IMO both swuehl and your logic will work, one is just the reverse logic of the other.

Not applicable
Author

Thanks for your answer.

er_mohit
Master II
Master II

in presentation tab below null symbol puts - replace it with 0 then ok

hope it helps