**Syntax**

**GROUP_PREVIOUS**(<any>;[<number>])

**Description**

Returns the value of the set k'th previous record in series. This can be used for introducing a lag for time series analysis and/or computing autocorrelation.

**Example 1:**

Given the following data:

First create a group**, **e.g. GROUPBY(#RawData!Groups)

Then use the GROUP_PREVIOUS(#RawData!Number), and the result will show the previous record's value in relation to the GROUPBY() column.

**Example 2:**

The following example illustrates how to compute the time a user has spent on a web site.

Given the following data:

First create a group**, **e.g. GROUPBY(#RawData!Session)

Next sort your timestamp in ascending order, e.g. GROUP_SORT_ASC(#RawData!TimeStamp)

Next use the GROUP_PATH(#RawData!url), and the result will show paths for all values of the column in ascending order in relation to the GROUPBY() column.

Next use GROUP_PREVIOUS(#RawData!TimeStamp)

Finally use DIFF(#Sheet1!Ascending_TimeStamp;#Sheet1!Previous_TimeStamp) to subtract the ascending TimeStamp from the Previous_TimeStamp to find how long the user spend on the url.