Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
a-5
Contributor III
Contributor III

Cumulative sum in line chart

Hi,

 

I'd need to calculate a cumulative sum in the line chart, but this formula doesn't work:

=RangeSum(Above(TOTAL Sum({$<[Type]={'$(vType)'},[Product Line]={'Product 1'},[Account channel]={'Direct'}>} [Value]),1,RowNo(TOTAL)))

I'll have 1 line for actual and 1 line for target in the same line graph and I'd like to cut the actual line - please see the example chart below:

a5_1-1710848043144.png

Any idea how to solve this? Thanks!

Labels (3)
3 Replies
Gabbar
Specialist
Specialist

If you want to remove red line from that part try using if statement.
The line is there because Rangesum is giving values for that period also.

try this:-
If (Sum({$<[Type]={'$(vType)'},[Product Line]={'Product 1'},[Account channel]={'Direct'}>} [Value])>0,
Rangesum_expression,(null() or 0 here))
)

a-5
Contributor III
Contributor III
Author

The range sum expression doesn't work either. Any advise on that? Thanks!

Gabbar
Specialist
Specialist

missed it there shouldnt be rowno(total) in the expression but rowno() only.

also lets make it null rather than 0.


try this expression:-

If (Sum({$<[Type]={'$(vType)'},[Product Line]={'Product 1'},[Account channel]={'Direct'}>} [Value])=0,
null(),
RangeSum(Above(TOTAL Sum({$<[Type]={'$(vType)'},[Product Line]={'Product 1'},[Account channel]={'Direct'}>} [Value]),0,RowNo()))
)