Announcements
cancel
Showing results for
Did you mean:
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:

Any idea how to solve this? Thanks!

Labels (3)

• ### Visualization

3 Replies
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))
)

Contributor III
Author

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

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()))
)