GSTATIF returns a summary statistic for date/times (slots) that meet the criteria in the date range specified by the GroupOffset and Grouping for the variable.
SYNTAX:
GSTATIF(VarNum,GroupOffset/StartDate,Grouping/EndDate, Statistic, Criteria)
VarNum: The variable number to get the total for.
GroupOffset/StartDate: Used with the Grouping parameter to set the dates to calculate the stat for. Sets the number of Groups (set by the Grouping Parameter) to be added to set the dates. See examples below. If this field is a date string (i.e. "07/16/2004") or refers to a cell with a date in it, it is assumed to be the start date to calculate the stat for.
Grouping/EndDate: Used to set which dates to calculate the stat for. If the Grouping is a date literal string (i.e. "07/16/2004") or refers to a cell with a date in it, it is assumed to be the end date to calculate the stat for. Common Groupings are:
"D" Days
“M” Monthly
"R" Report Dates
Click here for available Grouping options
Statistic: What summary to perform on the data
| AVG |
Average |
| COUNT |
Count of values |
| MAX |
Maximum |
| MIN |
Minimum |
| STDEV |
Statistical standard deviation of values |
| STDEVP |
Statistical standard deviation for the population of values |
| SUM |
Total or Sum of the values |
| VAR |
Statistical variance of values |
| VARP |
Statistical variance for the population of values |
| GEOMEAN0 |
Geometric Mean, ignore zeros |
| GEOMEAN1 |
Geometric Mean, convert zeros to ones |
| GEOMEAN2 |
Geometric Mean, if a zero found, add one to all |
Criteria: An SQL Where clause against the data tables (DATATBL, DATADDH, DATADDF, DATADD4,DATADD3, or DATADD5),. The tables have the following fields that can be used in the Criteria.
-
AUDITUSER
-
AUDITTIMESTAMP
-
VARID
-
DATESTAMP
-
CURVALUE
-
TEXTVALUE
-
STATUS
-
FORCED
EXAMPLES:
Example 1: Return the Average Influent BOD for days that have flow greater than zero.
=GSTATIF(11,1,"M","AVG","VARID = 1 AND CURVALUE > 0")
V11 - Influent BOD (daily parameter)
VARID of 1 is the Influent Flow variable.
Return the Average of variable 11 for days where VARID 1 value is greater than zero. In this case the average of 12/3 (255) and 12/8 (277).

Example 2: Return the Minimum hourly flow for the day when the basin status is On.
=GSTATIF(2,1,"D","MIN","VARID=1943 AND TEXTVALUE='On')
V2 = Hourly Flow variable
Varid 1943 - Hourly Text variable of basin status.