Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

pauledrich
Contributor

Static Week Numbers with dynamic start date

I have been grappling with this problem for some time and have made some headway but always hit the same issue.

we have an number of locations where a project has an implementation date and would like to compare each location with the implementation being week 0 as shown below:

Location

Implementation

Date

Week 0Week 1Week 2ETC
A22/05/2015Start Week SalesSum(Sales) -1 week after 22/05/2015Sum(Sales) -2 week after 22/05/2015
B20/04/2015Start Week SalesSum(Sales) -1 week after 20/04/2015Sum(Sales) -2 week after 20/04/2015
C09/03/2015Start Week SalesSum(Sales) -1 week after 09/03/2015Sum(Sales) -2 week after 09/03/2015
D09/02/2015Start Week SalesSum(Sales) -1 week after 09/02/2015Sum(Sales) -2 week after 09/02/2015
E21/01/2015Start Week SalesSum(Sales) -1 week after 21/01/2015Sum(Sales) -2 week after 21/01/2015

Any steer or help to implement a script solution would be appreciated - thanks in advance.

2 Replies

Re: Static Week Numbers with dynamic start date

Try this for first week:

sum({$<[Implemetaion Day]={">=[Implemetaion Day]+1<=[Implemetaion Day]+6"}>Sales)

and so one for next weeks...

pauledrich
Contributor

Re: Static Week Numbers with dynamic start date

Thank you Robert,

Scripting would help with calculating to today with a dedicated dimension without the need to have potentially an unknown number of expressions?

Really appreciate any additional advice.

Community Browser