Use parameters in visual calculations

Completed

Visual calculations have optional parameters to help you create complex calculations with minimal code.

Use the Axis parameter

Many functions have an optional Axis parameter, which can only be used in visual calculations. Axis influences how the visual calculation traverses the visual matrix. The Axis parameter is set to the first axis in the visual by default. For many visuals the first axis is ROWS, which means that the visual calculation is evaluated row-by-row in the visual matrix, from top to bottom.

The following parameter values control how the data is calculated:

Value Description Icon
ROWS Vertically across rows from top to bottom.
COLUMNS Horizontally across columns from left to right.
ROWS COLUMNS Vertically across rows from top to bottom, continuing column by column from left to right.
COLUMNS ROWS Horizontally across columns from left to right, continuing row by row from top to bottom.

Use the Reset parameter

Many functions have an optional Reset parameter that is available in visual calculations only. Reset influences if and when the function resets its value to 0 or switches to a different scope while traversing the visual matrix.

The Reset parameter is set to None by default, which means the visual calculation is never restarted. The following list describes the only valid values for the Reset parameter:

  • NONE is the default value and doesn't reset the calculation.
  • HIGHESTPARENT resets the calculation when the value of the highest parent on the axis changes.
  • LOWESTPARENT resets the calculations when the value of the lowest parent on the axis changes.
  • A numerical value which refers to the fields on the axis, with the highest field being one.

To better understand this concept, let's consider an axis that has three fields on multiple levels: Year, Quarter, and Month. As seen in the following example, HIGHESTPARENT is Year and LOWESTPARENT is Quarter, which affect how the running sum is calculated.

  • RUNNINGSUM([Sales Amount], HIGHESTPARENT) starts from 0 for every year.

  • RUNNINGSUM([Sales Amount], LOWESTPARENT) starts from 0 for every Quarter.

Lastly, a visual calculation that is defined as RUNNINGSUM([Sales Amount]) doesn't reset, and continues adding the Sales Amount value for each month to the previous values without restarting.

Note

Reset expects there to be multiple levels on the axis. If there's only one level on the axis, you can use PARTITIONBY.