OFMVSTATZ returns the specified summary statistic for a list of variables from a different facility with handling of symbols/data qualifiers. Variables can be of different types (IE Calculated, Daily, Hourly, etc...).
SYNTAX:
OFMVSTATZ("Facility", "Stat", Offset, Grouping, Decimal_Places, MDL_Rule, VarId1, VarId2,…VarId99)
or
OFMVSTATZ("Facility","Stat", Offset, Grouping, Decimal_Places, MDL_Rule "Where Clause")
Facility: Facility to query against, specified by its unique identifier in quotes (e.g. "OPSWWTUTOR")
Stat: The statistic in quotes (e.g. "AVG") of the value to calculate.
Stat |
Notes |
Avg |
Average of values |
Sum |
Total of values |
Max |
Maximum value |
Max_VarNum |
Returns the Variable Number of the variable that has the maximum value. |
Min |
Minimum value |
Min_VarNum |
Returns the Variable Number of the variable that has the minimum value. |
First |
First value found by date |
First_VarNum |
The variable number of the variable that is the first value found. |
Last |
Last value found by date |
Last_VarNum |
The variable number of the variable that is the last value found. |
GMean1 |
Returns the Geometric Mean of the values (convert 0 (zeros) to 1) |
GMean2 |
Returns the Geometric Mean of the values (Add one to all if zero found) |
GMean3 |
Returns the Geometric Mean of the values (Ignore zeros) |
NOS,Count |
Retruns the count or number of values found |
PERCxx |
Returns the value at the xx Percentile (i.e. PERC90). |
PERAxx |
Returns the value at the xx Percentile (averages two closest values if exact match not found) |
PERIxx |
Returns the value at the xx Percentile (interpolates two closest values if exact match not found). NOTE: This is the technique the Excel Percentile function uses. |
PERExx |
Returns the value at the xx Percentile (interpolates two closest values, excludes first and last value). NOTE: This is the technique the Excel PERCENTILE.EXC function uses. |
GTx |
Returns the number of values greater than x (i.e. GT30). |
LTx |
Returns the number of values less than x. |
EQx |
Returns the number of values equal to x |
NEx |
Returns the number of values not equal to x. |
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 availiable Grouping options
Decimal_Places: Sets the number of decimal places to be displayed. For variables with decimal places set to "Not Fixed" click here for additional formatting options.
MDL Rule Sets when to display the MDL symbol (<,>, ND) with the calculated statistic. Valid settings are:
1 - Display MDL symbol if one of the values contains the MDL symbol
2 - Display MDL symbol if over half the values contains the MDL symbol.
3 - Display MDL symbol if all of the values contains the MDL symbol.
4 - Cascade all symbols
VarId1..VarId99: A comma separated list of variables that sets which variables to calculate from. NOTE: This function uses VARIDs, not Varnums.
OR
Where clause Instead of providing a list of variables, you can use an SQL Where clause against the VarDesc table to get the list of variables. I.E. “Units = 'mg/L'” wound return all variables with Units set to mg/L. See Examples.
NOTES:
To Locate this formula when designing a report, use Locate, Other Facility Group Summary or Locate, Other Facility Combined Group Summary.
SEE ALSO:
MVSTAT, MVSTATDATE, MVSTATZ, OFMVSTAT, OFMVSTATDATE
EXAMPLES:
OFMVSTATZ("OPSWWTUTOR", "AVG",1,"M",1,0, 36) Returns the average for the current month for variable id 36 (Varnum 4001-Effluent Flow) from the OPSWWTUTOR facility to zero decimal places. If one or more values have a symbol (<,>...) it will be returned with the average (e.g. <4)
OFMVSTATZ("OPSWWTUTOR","MIN",1,"M",2,1,4011,4041) Returns the minimum value to 2 decimal places for the current month for varids 37 and 40 (Varnums 4011 and 4041) from the OPSWWTUTOR facility. If the minimum value has a data qualifier it will be reported. For example, <0.25.
OFMVSTATZ("OPSDWTUTOR","MAX",1,"M",1,1,"UNITS = 'mg/L'") Returns the maximum value for the current month for all variables in facility OPSDWTUTOR that have mg/L as units. If the maximum value has a data qualifier it will be reported. For example, <2.4.