Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

13 week average

.

4 Replies
fdelacal
Valued Contributor

Re: 13 week average

YOU SHOUL DO IT WHIT THE CALENDAR DATE NOT SALES DATE

HOPE THAT HELPS

datanibbler
Esteemed Contributor

Re: 13 week average

Hi TimmyHop,

I would suggest a two-step process:

- Devise a way to assign a running number (1,2,3...) to the weeks that have sales - not to the ones without. Then you'll have a new field, say you call it "Week_w_Sales" (numeric).

- You could then use set_analysis and tell QlikView to calculate the avg. of all those weeks_with_sales between the >week_with_sales 13 weeks ago< and the current week. Should look sth like this

>>> avg({1<Week_with_sales = {"'>= $(=(Week(TODAY())-13))"}>} sales) <<<

HTH

Best regards,

DataNibbler

Not applicable

Re: 13 week average

Hi, thanks for your reply.

i already have a chart expression  that seems to do exactly what i want..

..

datanibbler
Esteemed Contributor

Re: 13 week average

Hi TimyHop,

the script does not support set_analysis (what I proposed), but it should be possible to put your formula here into the script - just try it out, if the commands turn blue, they are supported and functional. You can then put this expression into your LOAD statement and you'll have an additional field that you can use i a diagram.

Best regards,

DataNibbler

Community Browser