Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Four Week Average at Script Level

Here is the file.

1 Solution

Accepted Solutions

Re: Four Week Average at Script Level

You have to aggragate per week first. Try this:

temp1:

LOAD

[Fiscal Week Ending] ,

sum([Sales Out $]) as Sales

from US.xls (biff, embedded labels, table is "Sheet 1$") group by [Fiscal Week Ending];

final:

load *,

Rangesum(Sales,peek(Sales,-1),peek(Sales,-2),peek(Sales,-3))as myRollingAvg

Resident temp1;

drop table temp1;


talk is cheap, supply exceeds demand
2 Replies

Re: Four Week Average at Script Level

You have to aggragate per week first. Try this:

temp1:

LOAD

[Fiscal Week Ending] ,

sum([Sales Out $]) as Sales

from US.xls (biff, embedded labels, table is "Sheet 1$") group by [Fiscal Week Ending];

final:

load *,

Rangesum(Sales,peek(Sales,-1),peek(Sales,-2),peek(Sales,-3))as myRollingAvg

Resident temp1;

drop table temp1;


talk is cheap, supply exceeds demand
Not applicable

Re: Four Week Average at Script Level

Thanks Gysbert. It Works.

Working, was not concentrating on the repitition of data, my mistake.

Regards

Nassar

Community Browser