Skip to main content Skip to complementary content

Top - chart function

Top() evaluates an expression at the first (top) row of a column segment in a table. The row for which it is calculated depends on the value of offset, if present, the default being the top row. For charts other than tables, theTop() evaluation is made on the first row of the current column in the chart's straight table equivalent.

Syntax:  

Top([TOTAL] expr [ , offset [,count ]])

Return data type: dual

Arguments
Argument Description
expr The expression or field containing the data to be measured.
offset

Specifying an offset of n, greater than 1, moves the evaluation of the expression down n rows below the top row.

Specifying a negative offset number makes the Top function work like the Bottom function with the corresponding positive offset number.

count By specifying a third parameter count greater than 1, the function will return a range of count values, one for each of the last count rows of the current column segment. In this form, the function can be used as an argument to any of the special range functions. Range functions
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

Information noteA column segment is defined as a consecutive subset of cells having the same values for the dimensions in the current sort order. Inter-record chart functions are computed in the column segment excluding the right-most dimension in the equivalent straight table chart. If there is only one dimension in the chart, or if the TOTAL qualifier is specified, the expression evaluates across full table.
Information noteIf the table or table equivalent has multiple vertical dimensions, the current column segment will include only rows with the same values as the current row in all dimension columns, except for the column showing the last dimension in the inter-field sort order.

Limitations:  

  • Recursive calls will return NULL.

  • Sorting 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.

Example: Chart expressions
Example Result

Top( Sum(Sales) )

Returns the value of Sales for the first (top) row of a column segment in a table.

Example - Top fundamentals

Example - Top scenario

Example - Chart expression using Top

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!