Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

calculate the CA for the first 7 days rolling back

How to do a rollback for the first 7 times/days in which I have Promotion ?

I use the following expression to calculate an average rolling back 7days

((Sum({<Promo ={1},DateTest={">=$(=Date(Today() - 9)) <$(=Date(Today()-2))"}>} [Prix de vente TTC]))/7)

My problem if the first 7 days I probably  have  Promotion or not for example , the resultas will be false  ,


I need to do a rollback fo the first 7 days in wich promo = 1 (i have a promotion)? How to modify the expression ?


An example :


In the first example I should calculate CA in wihch promo = 1 and the first 7 days rolling back

26/02/201627/02/201628/02/201629/02/201601/03/2016

20/02/201621/02/2016


Sans titre.png

3 Replies
Gysbert_Wassenaar

Maybe like this:

sum({<DateTest={'>=$(=FirstSortedValue({<Promo={1},Date={'<=$(=Today()-2)'}>} Date,-Date, 7))<=$(=Today()-2)'}>}[Prix de vente TCC])

If not, then please post a small qlikview document that illustrates the problem.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I attach an example many thanks

Gysbert_Wassenaar

Try this expression:

=sum({<promo={1},WeekDate= {">=$(=Date(Max({<WeekDate={'<=$(=Date(max(WeekDate)-2))'}, promo={1}>} WeekDate,7)))<=$(=date(max(WeekDate)-2))"} >}SoldAmt)


talk is cheap, supply exceeds demand