Skip to main content Skip to complementary content

NoOfColumns - chart function

NoOfColumns() returns the number of columns in the current row segment in a pivot table.

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.

Syntax:  

NoOfColumns([total])

Arguments
Argument Description
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

In a pivot table with multiple horizontal dimensions, the current row segment includes only columns with the same values as the current column across all dimension rows—except for the row showing the last dimension in 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.

Example: Chart expression
Example Result
IF(ColumnNo() > NoOfColumns() - 2, Sum(Sales), Null()) Where the ColumnNo is greater than the NoOfColumns minus 2, the chart will return the value Sum(Sales). Otherwise, if ColumnNo is less than that it will return NULL. In this example, from the third column onwards, it will return values while columns 1 and 2 will not return any value.

Example - NoOfColumns fundamentals

Example - NoOfColumns scenario

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!