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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculate cumulative value in expression

Hi,

I need to calculate a value like "= sum(x) / cumulative sum of y"

I can only find cumulative expression based on "above()" function, which doesn't work in this case. I also tried invisible helper column, but this messes up the axes scaling.

What would be the best approach to solve this?

1 Solution

Accepted Solutions
Not applicable
Author

Turns out I had a pretty simple error in my expression that took a while to spot

Instead of RangeSum(Above(sum(x), 0, RowNo()))

I had RangeSum(Above(sum(x)), 0, RowNo())

The results were different of course, and I only spotted it when working on an example for you.

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Kushal_Chawda

It depends on the what data you have & what is the output you need.

Perhaps you need to use Peek & Previous functions to do the cumulative values

see the below links

https://www.qlikcommunity.com/thread/181718

https://www.qlikcommunity.com/thread/138528

sunny_talwar

May be if you can share a sample, someone here can help you get a better answer.

Mark_Little
Luminary
Luminary

Hi,

Like Kush has mentioned, in a normal case like this i would be looking to add a running total field in my script using the peek and previous functions, but not knowing anything about the data I couldn't say if this would be useful in your case.

So like Sunny has said a sample would be helpful.

Mark

simotrab
Creator III
Creator III

Probably as already said, if you give other informations, it is more simple to help.

Meanwhile I think you can try

Sum(x)/RangeSum(above(Sum(y),0, RowNo()))

Hope it can be useful.

Not applicable
Author

Turns out I had a pretty simple error in my expression that took a while to spot

Instead of RangeSum(Above(sum(x), 0, RowNo()))

I had RangeSum(Above(sum(x)), 0, RowNo())

The results were different of course, and I only spotted it when working on an example for you.