Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit_B
Creator
Creator

Cumulative sum with Set Analysis

Hi everyone,

I am using two variables to show the month before the current date, one variable shows the year (vCompYear) and the other shows the month (vCompMonth).
For example,
* If the current month is October 2023 then vCompYear = 2023vCompMonth = 9.
* If the current month is January 2024 then vCompYear = 2023vCompMonth = 12.

In KPI I use these variables to display the previous month amount - work fine.
Sum({1<Year={'$(vCompYear),Month={'$(vCompMonth)'}>}Sales)

In addition, I need to calculate the cumulative amount of that year (vCompYear) up to that month (vCompMonth).
For example,
* If the current month is October 2023 then I will receive the amount of January to September 2023.
* If the current month is January 2024 then I will receive the amount of January to December 2023.

I tried some solutions I found here but I didn't get the right result.
How to calculate the cumulative amount?

Thanks.

Labels (4)
1 Solution

Accepted Solutions
vincent_ardiet_
Specialist
Specialist

Something like this maybe?
Sum({1<Year={$(vCompYear)},Month={"<=$(vCompMonth)"}>}Sales)

View solution in original post

1 Reply
vincent_ardiet_
Specialist
Specialist

Something like this maybe?
Sum({1<Year={$(vCompYear)},Month={"<=$(vCompMonth)"}>}Sales)