Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
vipingarg23
Creator
Creator

How to calculate accumulative value

HI Team,

Please find sample file as an attachment.

Here I have One field Month and One chart in which I am calculating Sum(Value) for ID.

My Requirement is that if user select Oct from month then SUm(Value) should be (Sep+Oct) and if user is selecting Dec then value should be (Sep+Oct+Nov+Dec) like this....

Can anyone help me on the same.?

Regards,

Vipin Garg

7 Replies
diego_vazquez
Contributor III
Contributor III

Hello,

you can try this expresion:

IF(Month = 'Sep',  Sum({<Month={'Sep','Oct'}>}Value), IF(Month = 'Dec', Sum({<Month={'Sep','Oct','Nov','Dec'}>}Value), Sum(Value)))

Diego

vipingarg23
Creator
Creator
Author

Hi..Thanks for your reply but it is just sample data. I have lots of Month and Year. So I can't do manually for every selection.

vipingarg23
Creator
Creator
Author

I want like

If sep is selected then Only sep data

if Oct is selected, it will show sep+oct

if Nov is seleted, it will show sep+oct+nov

If dec then sep+oct+nov+dec

so on....

diego_vazquez
Contributor III
Contributor III

try to group the selections you need in a load inline in the script.

vipingarg23
Creator
Creator
Author

I am not taking data from inline. I have field like Sales Period which contains lots of Month Year Value

diego_vazquez
Contributor III
Contributor III

Apply what I wrote you earlier but with the months you need

johnca
Specialist
Specialist

There are so many versions of performing cumulative sums in the script. Here's one...

Re: Cumulative sum in script