WAVGn returns a weekly average of a specified variable. The week is defined by a number (n), which specifies the begining day of the week (for n=7, the week is Sunday through Saturday). The value calculated is placed on the last day of the defined week. Click here for a table demonstrating the different week definitions available.
SYNTAX:
WAVGn(Cx, optional Time Increment)
where :
n is a number that defines the week
Cx is a conditional variable x
Time Increment Optional - specifies the source variables (Cx) Frequency when the Source Variable (CX) and target variable's (i.e. the variable being calculated) frequencies do not match.
NOTES:
n can only be 1 through 20, all other numbers will come up as an invalid equation in variable setup.
The result is stored based on target variables frequency:
EXAMPLE 1: Return the Weekly average from a variable
Source variable (70) is set to Daily and Target variable (93) is also set to Daily. Because both the Source and Target variables are the same (Daily), the time increment BYDAY will be used.
V93 = WAVG3(C70)
Defines variable 93 as a single value equal to the weekly average of variable 70 with the week defined as Wednesday through the following Tuesday. The average value is listed on the last day of each week, in this case: Tuesday.
EXAMPLE 2: Return the Weekly average from an Hourly variable into a Daily Calculation.
Source variable (4714) is set to Hourly and Target variable (4715) is set to Daily.
V4714 - Is an hourly parameter
V4715 - Is a daily calculation
V4715 = WAVG3(V4714,BYHOUR)
Note: You MUST specify the Time Increment (BYHOUR) that matches the source variables frequency (IE the source variable V4714 is Hourly, therefore we specify BYHOUR) in order for the function to return the correct value.
See: Working with Daily Detail Variables in Calculations.