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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Keerthi1234
Contributor III
Contributor III

Cumulative Sum: 0+value evaluates - instead of value

Hi All,

I need

Product VERSION Tot_Cost Cumulative_Sum
A 0 100 100
A 1 200 300
A 0 0 300
B 2 300 300
B 0 50 350

 

Cumulative Sum is calculated as:
RangeSum(Above(Total Aggr(Sum(Tot_Cost), Product, (VERSION, Tot_Cost)), 0, RowNo(Total)))

Tot_Cost here is calculated as:
RangeSum(sum({$<VERSION={0}>} Field 1), sum({$<VERSION={0}>} Field 2)),
Here I noticed when the value of a field is - then applying sum is the value changes to 0..why does that happen?

But  I get the result as 

Product VERSION Tot_Cost Cumulative_Sum
A 0 100 100
A 1 200 300
A 0 0 -
B 2 300 300
B 0 50 350

Why is this happening is it because all the null values in Tot_cost are converted to 0 since it is a measure?Has anyone faced the same issue if so please help me in understanding why this happens.

Labels (3)
1 Reply
sbaro_bd
Creator III
Creator III

Hi @Keerthi1234 ,

Try this : add a Alt() function around the fields to give you an alternative value to NULL value. So the new expression for Tot_Cost becomes : 

RangeSum(sum({$<VERSION={0}>} Alt(Field 1,0)), sum({$<VERSION={0}>} Alt(Field 2,0)))

Regards.