Last() returns the value of
an expression evaluated with a pivot table's dimension values as they appear in the
last column of the current row segment in the pivot table. This function
last([TOTAL] expr [, offset [, count]])
||The expression or field containing the data to be measured.|
Specifying an offset of 0 will evaluate the expression on the current row.
Specifying a negative offset number makes the First function work like the Last function with the corresponding positive offset number.
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.
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.
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.
last( sum( Sales ))
last( sum( Sales ), 2 )
last( total sum( Sales )
rangeavg (last(sum(x),1,5)) returns an average of the results of the sum(x) function evaluated on the five rightmost columns of the current row segment.