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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
contributor_H
Contributor III
Contributor III

12 Columns for 12 rolling months

I'm struggling with the following

Having two columns (date and quantity). I want to create 12 rolling columns for summing the quantity for each month for this year,
for example
1st column let's name it current_month_quantity would be the summation of quantity from 1'st of month to today
2nd column named month_2_quantity would be the summation of the quantity for the previous month
3rd column named month_3_quantity would be the summation of the quantity for the previous-previous month
.
.
.
till 12 month

I've tried something as follows but it doesn't seem to work
Sum({<date = {">=$(=MonthStart(Max(date))) <=$(=Max(date))"}>} quantity) 
Sum({<date = {">=(=MonthStart(Max(date),−1))<=(=MonthEnd(Max(date), -1))"}>} quantity) 

 

any help is appreciated

Labels (4)
11 Replies
rubenmarin

Hi, then you need to use that field to filter in set analysis:

 Sum({<DateLastEditted_Default= {">=$(=Date(MonthStart(Max(DateLastEditted_Default),−1)))<$(=Date(MonthStart(Max(DateLastEditted_Default))))"}>} TotalQuantity)

contributor_H
Contributor III
Contributor III
Author

Hi Ruben,

It seems that I wasn't putting the right field name in front of the condition, and I believe it solved my issue.

I really appreciate the time you took to solve the issue, thanks a lot.