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

Announcements
FLASH SALE: Save $500! Use code FLASH2026 at checkout until Feb 14th at 11:59PM ET. Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Trailing 52 weeks


I am using the calendar that has year/week for example this week is 2013/38

I want to write an expression that contains the past 52 weeks . Sum the previous 52 weeks of the field SalesAmount in one column, then the next column will be the previous 52 weeks from the week before. and so on,

For example First row is header info

Item                    Previous 52(1a)               Previous 52(1b)                  Previous 52(1c)

Product A          Sales from the                 Sales from the                     Sales from the

                          Previous 52 weeks          Previous 52 weeks               Previous 52 weeks

                          Starting from 2013/37     Starting from 2013/36          Starting from 2013/35

2 Replies
Not applicable
Author

http://community.qlik.com/blogs/qlikviewdesignblog/2012/10/12/accumulative-sums

Hi Lance,

The above link might be useful to you.

Good Luck

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try this expressions

For current week to last 52 weeks

=Sum({<DateFieldName={'>=$(=WeekStart(Max(Date), -51))<=$(=WeekEnd(Max(Date)))'}>} MeasureName)

For previous week to last 52 weeks

=Sum({<DateFieldName={'>=$(=WeekStart(Max(Date), -52))<=$(=WeekEnd(Max(Date), -1))'}>} MeasureName)

Hope this helps you.

Regards,

Jagan.