Before - chart function
Before() returns the value of an expression evaluated with a pivot table's dimension values as they appear in the column before the current column within a row segment in the pivot table.
Syntax:
before([TOTAL] expr [, offset [, count]])
Arguments:
Argument | Description |
---|---|
expr | The expression or field containing the data to be measured. |
offset |
Specifying an offset n, greater than 1 moves the evaluation of the expression n rows further to the left from the current row. Specifying an offset of 0 will evaluate the expression on the current row. Specifying a negative offset number makes the Before function work like the After function with the corresponding positive offset number. |
count |
By specifying a third parameter count greater than 1, the function will return a range of values, one for each of the table rows up to the value of count, counting to the left from the original cell. |
TOTAL |
If the table is one-dimensional or if the qualifier TOTAL is used as argument, the current column segment is always equal to the entire column. |
On the first column of a row segment a NULL value will be returned, as there is no column before this one.
If the pivot table has multiple horizontal dimensions, the current row segment will include only columns with the same values as the current column in all dimension rows except for the row showing the last horizontal dimension of the inter-field sort order. The inter-field sort order for horizontal dimensions in pivot tables is defined simply by the order of the dimensions from top to bottom.
Examples:
before( sum( Sales ))
before( sum( Sales ), 2 )
before( total sum( Sales ))
rangeavg (before(sum(x),1,3)) returns an average of the three results of the sum(x) function evaluated in the three columns immediately to the left of the current column.