WSUMn returns the weekly sum of as specified variable, Cx, where n defines the seven day week.
SYNTAX:
WSUMn(Cx, optional Time Increment)
where :
n specifies the Week Definition, which specifies the desired begining and end of 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:
The variable to be summed must be specified as a Conditional Variable; use "C" instead of "V" to specify the variable.
The result is stored based on target variables frequency:
EXAMPLE 1: Return the Weekly sum from a variable
Source variable (70) is set to Daily and Target variable (143) is also set to Daily. Because both the Source and Target variables are the same (Daily), the time increment BYDAY will be used.
V143 = WSUM2(C70)
Variable 143 calculates a weekly total of variable 70. The week is defined as Tuesday through Monday (n = 2); therefore, the weekly result will be stored each Monday:
Note: The first week is a sum of 3 days only because there is no data in the previous month, otherwise it would include that data as well.
EXAMPLE 2: Return the Weekly sum from an Hourly variable into a Daily Calculation.
Source variable (70) is set to Hourly and Target variable (143) is set to Daily.
V70 - Is a hourly parameter
V143 - Is a daily calculation
V143 = WSUM7(V70,BYHOUR)
Note: You MUST specify the Time Increment (BYHOUR) that matches the source variables frequency (IE the source variable V70 is Hourly, therefore we specify BYHOUR) in order for the function to return the correct value.
See: Working with Daily Detail Variables in Calculations.