Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
happyjoshua777
Creator
Creator

incorrect Moving Avg and Upper control

Hello,

I have followed all the steps which in 'Creating a Moving Range chart ' of the Cookbook, namely:


LOAD @1:7 As Year,

@8:11 As Month,

@12:18 as [MaxTemp(C)],

@19:26 As [MinTemp(C)],

@27:34 as [AF Days],

@35:42 as [Rain(mm)],

@43:50 as [Sun Hours]

FROM

[http://www.metoffice.gov.uk/pub/data/weather/uk/climate/stationdata/heathrowdata.txt]

(fix, codepage is 1252, header is 7 lines)

Where @1:7 < 2013;

* Created a new line chart

* The added expressions:

Rainfall(mm) Sum([Rain(mm)])

Moving
Range
fabs(Above(Sum([Rain(mm)]))-Sum([Rain(mm)]))
Moving
Avg
Avg({<Year={">=1961<=1990"}>} total Aggr(fabs(Ab
ove(Sum({<Year={">=1961<=1990"}>} [Rain(mm)]))-
Sum({<Year={">=1961<=1990"}>} [Rain(mm)])), Year))
Upper
Control
[Moving Avg] * 3.267

and I got the chart as in moving_avg.png

As one can see the Moving Avg and Upper Control are way below the thresholds

However, the results should be as per Moving_Range_correct.png

as described on p. 130 of the Cookbook

how can I correct the output I am currently receiving from the Control Chart (see moving_avg.png)?


thanks

1 Solution

Accepted Solutions
happyjoshua777
Creator
Creator
Author

Below is the screen shot from the Cookbook.

as one can see Rainfall(mm) expression does very much belong there.

I went through the instruction again and got the correct results refer to control_chart_moving_rng.png

I believe the issue was due to [Avg] expression being mislabeled as something like 'Moving Avg'

Which caused Upper and Lower Process Limit expressions not be able to refer to it as, for example, Upper ... Limit expressions is as follows:

[Avg] + (Avg({<Year={">=1960<=1980"}>} total Aggr(fabs(Above(Sum({<Year={">=1960<=1980"}>}[Rain(mm)]))-Sum({<Year={">=1960<=1980"}>}[Rain(mm)])), Year)) * 2.66)


As one can see it utilises [Avg] and not something like [Moving Avg]

 


thanks


control_chart_moving_rng.png

View solution in original post

5 Replies
techvarun
Specialist II
Specialist II

Are you looking for something like the attached?

effinty2112
Master
Master

Hello,

          Take out the Rainfall(mm) expression - it doesn't belong in this chart that's looking at variation rather than value. The Moving Range expression does belong but I can't see it in your image. Check it's there and if so that it hasn't been hasn't been disabled.

Cheers

Andrew

happyjoshua777
Creator
Creator
Author

Below is the screen shot from the Cookbook.

as one can see Rainfall(mm) expression does very much belong there.

I went through the instruction again and got the correct results refer to control_chart_moving_rng.png

I believe the issue was due to [Avg] expression being mislabeled as something like 'Moving Avg'

Which caused Upper and Lower Process Limit expressions not be able to refer to it as, for example, Upper ... Limit expressions is as follows:

[Avg] + (Avg({<Year={">=1960<=1980"}>} total Aggr(fabs(Above(Sum({<Year={">=1960<=1980"}>}[Rain(mm)]))-Sum({<Year={">=1960<=1980"}>}[Rain(mm)])), Year)) * 2.66)


As one can see it utilises [Avg] and not something like [Moving Avg]

 


thanks


control_chart_moving_rng.png

happyjoshua777
Creator
Creator
Author

was not able to open this qvw file as I have a free version of of Qv

please copy and paste your code

ta

Anil_Babu_Samineni

Script here

LOAD @1:7 As Year,

@8:11 As Month,

@12:18 as [MaxTemp(C)],

@19:26 As [MinTemp(C)],

@27:34 as [AF Days],

@35:42 as [Rain(mm)],

@43:50 as [Sun Hours]

FROM

[http://www.metoffice.gov.uk/pub/data/weather/uk/climate/stationdata/heathrowdata.txt]

(fix, codepage is 1252, header is 7 lines)

Where @1:7 < 2013;

Front end

Year is dimension

Expressions are

1) fabs(Above(Sum([Rain(mm)]))-Sum([Rain(mm)]))

2) Avg({<Year={">=1961<=1990"}>} total Aggr(fabs(Above(Sum({<Year={">=1961<=1990"}>} [Rain(mm)]))-

Sum({<Year={">=1961<=1990"}>} [Rain(mm)])), Year))

3) Column(2) * 3.267

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful