Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I have a problem with the addition of the purchase. The sum that I use for this is: number * number in package * number of carts + other. However, if one of these is 0 then this calculation is already wrong. Someone any idea how I can solve this within qliksense?
Thanks in advance!
0 or NULL?
If you are adding parts that could be NULL, try Rangesum()
May be use RangeSum() instead of +... something like this
RangeSum(Exp1, Exp2, Exp3, ....)
does rangesum also work with *?
Could you post your complete expression and a sample of the field values?
Consider using something like
Alt(FIELD,0)
to handle NULL for a single field, for example in a product
=Alt(FIELD1,0) * Alt(FIELD2,0)
Always consider using aggregation functions in an expression.
If you are using Sum( as outer Aggregation, you probably can just use
=Sum( FIELD1 * FIELD2)
Rangesum() can be used to handle NULL in an addition
Rangesum(FIELD1, FIELD2) // FIELD1+FIELD2
Rangesum(FIELD1*FIELD3, FIELD2) // FIELD1*FIELD3+ FIELD2
See also
thankyou,
my calcuation now is:
KOLLI*INHOUD*KALEPRIJS+REST*KALEPRIJS as Totaalprijs,
And do you need to handle NULL or is there some other issue?
If you one of the fields could be NULL, try
Rangesum(KOLLI*INHOUD*KALEPRIJS, REST*KALEPRIJS) as Totaalprojs,
assuming you want to handle NULL as zero.