GDIFF return the min, max, average, or sum of the differenfences of a group of values based on a difference type specified.
SYNTAX:
GDIFF(VarNum,GroupOffset/StartDate,Grouping/EndDate, Stat, Type)
VarNum: The variable number to look at.
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
Stat: The statistic that will be returned. possible inputs are "min", "max", "avg", or "sum".
Type: The type of difference to be taken for each day.
Type 1: Absolute value of today - yesterday
Type 2: today - yesterday
Type 3: yesterday - today
Type 4: today - yesterday using rollover
Type 5: Yesterday - today. If result below 0, count it as 0.
NOTES:
The data that contributes to the result is only data that is dependant on the report month. This means that the difference between the 1st and the 31st is not counted.
EXAMPLES:
The above example demonstrates the use of this function with all possible outcomes. See how we can manually preform what this function does.
GDIFF(1, 1, "M", "AVG", 1) returns the average difference of this months variables from day to day.
GDIFF(1, 1, "Y", "MAX", 1) Returns the Maximum difference for variable 1 for an entire year.