GGMMEDZ returns the geometric mean or median (depending on data - if one or more values contain a data qualifier function will return the median, otherwise it returns the geometric mean) see Average and Geometric Mean reporting for California DMR) of all of the values (values can contain data qualifiers) in the date range specified by the Offset and Grouping for the variable.
SYNTAX:
GGMMEDZ(VarNum, GroupOffset/StartDate, Grouping/EndDate, Decimal Places, Geo Mean Type, optional No Value Print)
VarNum: The variable number to get the average 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 Settings are:
"D" Days
“M” Monthly
"R" Report Dates
“Y” Yearly
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.
Geo Mean Type: Sets how zero's are handled in the calculation.
0 - Ignore zeros
1 - Convert 0 to 1
2 - Add one to all
Type |
Values |
Values Used |
Result |
0 |
200,0,52,74 |
200,52,74 |
91.6 |
1 |
200,0,52,74 |
200,1,52,74 |
29.6 |
2 |
200,0,52,74 |
201,1,53,75 |
28.9 (29.9-1) |
No Value Print: Sets a string to be displayed if there are no values in the date range.
NOTES:
In Design, Spread Reports use Locate, Group Summary to place this formula on a report.
EXAMPLES:
GGMMEDZ(1,3,"Q",2,1) returns the average median of the values for variable 1, of the second quarter of the report displaying 2 decimals and a MDL symbol if at least one value in the quarter contains a symbol.
GGMMEDZ(1,3,"Q",2,1,"X") returns the average median of the values for variable 1, of the second quarter in the group displaying 2 decimals and a MDL symbol if at least one value in the quarter contains a symbol. Returns "X" if no values are found.
1 |
<1 |
Since the values contain data qualifiers (i.e. <), we return the median. Since there is an even number of values, we evaluate the middle two numbers (<1 and 18). Again, since the middle two numbers contain a data qualifier we take the lower of the two numbers. |
2 |
245 |
The data set does not contain any data qualifiers, so we return the Geometric Mean of 245. |
3 |
64 |
The data set contains data qualifiers, so we return the median. The middle two numbers are 62 and 66 so we take the average (64). |