Skip to main content


After() returns the value of an expression evaluated with a pivot table's dimension values as they appear in the column after the current column within a row segment in the pivot table.


after([ total ] expression [ , offset [,n ]])

Information note This function returns NULL in all chart types except pivot tables.
Information noteSorting on y-values in charts or sorting by expression columns in tables is not allowed when this chart function is used in any of the chart's expressions. These sort alternatives are therefore automatically disabled. When you use this chart function in a visualization or table, the sorting of the visualization will revert back to the sorted input to this function.


  • expression: The expression or field containing the data to be measured.
  • offset: Specifying an offset n, greater than 0, moves the evaluation of the expression n rows further up from the current row. Specifying an offset of 0 will evaluate the expression on the current row. Specifying a negative offset number makes the Above function work like the Below function with the corresponding positive offset number.
  • n: By specifying a third parameter n greater than 1, the function will return a range of n values, one for each of n table rows counting to the right 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.

    Defining the aggregation scope

On the last column of a row segment a NULL value will be returned, as there is no column after 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.


after( sum( Sales ))

after( sum( Sales ), 2 )

after( total sum( Sales ))

rangeavg (after(sum(x),1,3)) returns an average of the three results of the sum(x) function evaluated in the three columns immediately to the right of the current column.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: