Examples of Chart Inter Record functions

Top Function Examples

These examples are made with the top function, but may be applied in a similar manner to the bottom, first and last functions. However, note that the first and last functions are relevant only to pivot tables.

Example 1:  

Study the straight table below, depicting the use of the top function in a one-dimensional table:

In the single dimension case, the top function will always refer to the first data row of the table ( The total row is not included.)

Note that expressions using the top function will be properly evaluated in the total row too since the total has a clear relation to a specific column segment, in this case the entire column.

 

Example 2:  

Below is a two-dimensional straight table sorted primarily on the field Grp.

The top function without the total qualifier will now return the expression evaluated on the top row within the innermost sort group (Grp dimension in this case). One value will be returned for Grp = A and one for Grp = B.

By using the total qualifier in the multi dimension case, you may again refer to the absolute top row of the table with the same value being returned for all rows. The expression will of course be evaluated for the column segment spanning the entire column.

The expression using the top function without he total qualifier will evaluate to NULL in the total row, because it cannot be clearly associated with a specific column segment.

We will now convert the above straight table to a pivot table with all totals activated.

The expression using the top function without he total qualifier will evaluate to NULL in the total row, because it cannot be clearly associated with a specific column segment. However, all the partial sums will be evaluated for each column segment.

The expression using the total qualifier will lack values in the partial totals but will return a value in the grand total row.

 

Example 3:  

Study the following straight table sorted on the field Grp:

We may continue by changing the inter field sort order so that the chart is sorted primarily on the field Month. The table will now look like this:

Above Function Examples

These examples are made with the above function, but may be applied in a similar manner to the below, before and after functions. However, note that the before and after functions are relevant only to pivot tables.

Example 4:  

Study the straight table below, depicting the use of the above function in a one-dimensional table:

The third column shows the expression sum(Val) evaluated one row above the current row, which can be confirmed by comparing with the values for sum(val) in the second column. The above function returns NULL on the first row, as there is no row above on which to evaluate the expression. The above function always returns NULL on all total rows.

The fourth column demonstrates the most typical use of this function, i.e. to calculate the difference between e.g. different time periods.

 

Example 5:  

Study the two-dimensional pivot table below:

The above function without the total qualifier (third column) will only act within each sort group. A NULL value will be returned on the top row of each column segment.

When a total qualifier is added (fourth column), the entire column will be regarded as one column segment. Only the top row will return NULL. All total rows are disregarded and return NULL.

 

RowNo and NoOfRows Function Examples

This example is made with the RowNo and NoOfRows functions, but may be applied in a similar manner to the ColumnNo and NoOfColumns functions. However, note that the ColumnNo and NoOfColumns functions are relevant only to pivot tables.

Example 6:  

Study the two-dimensional pivot table below:

Column 3 The RowNo function will return the row number within each sort group column segment. In subtotal rows, the row number 0 will be returned, because these totals clearly belong to a specific column segment. NULL will be returned in the grand total row.

Column 4 With the total qualifier, the RowNo function will return the row number within the entire column. In subtotal rows a NULL value will be returned. In the grand total row 0 will be returned.

Column 5 The NoOfRows function will return the number of data rows within each sort group column segment. In subtotal rows, the same number will be returned as in data rows. NULL will be returned in the grand total row.

Column 6 With the total qualifier, the NoOfRows function will return the number of data rows within the entire column, which is the same as what will be returned in the grand total row. In subtotal rows NULL will be returned.

dimensionality ( )

For a pivot table with three dimension columns to the left the following would be returned:

3 for all ordinary data cells.

2 for 1st level partial sums and entries not expanded in the 3rd column.

1 for 2nd level partial sums and entries only expanded in the 1st column.

0 for grand total cell.

dimensionality ( )

secondarydimensionality ( )