Skip to content

Expression in a cube

Sometimes you may wish to use an expression in a cube. You can use it as a cube statistic. See Include statistics on a cube

Firstly, use the Expression Editor to make an expression.

Expression as a statistic

In this example we will use the following expression:

Expression
[Cost] * 1.175

To use this expression in a cube as a statistic, click on 'Statistics' and then 'Add Statistics'. You will then see this dialog:

Add Statistics dialog with Specify other Table, Variable or Expression option

Select the "Specify other Table, Variable or Expression" radio button and drag the expression (using its drag handle next to its title) onto the panel on this dialog. You will then be able to choose which function to use, and what statistic you want to display for this value. You can add more Expressions or use different functions as required. Once you have chosen the cube axes, click build to see the changes.

Note

It is also possible to add an Expression as a statistic simply by dragging it, using its drag handle, into the middle of the Cube display.

The diagram below shows a cube with a single axis of 'Income' to which two statistics based on this Expression have been applied.

Cube showing Income axis with two expression-based statistics applied

Expression as a dimension

Text expressions can be used as normal dimensions as well as shredded dimensions on a Cube.

In this example we will use the following expression:

Expression
AddStr([Surname], " lives at " ,[Address])

To use this statistic as a normal dimension on a cube, left drag it onto an axis.

Cube showing a text expression dimension with concatenated Surname and Address

Click build and set the cube size parameters when prompted. Click OK to view results.

To use this statistic as a shredded dimension on a cube, use a right drag action onto a cube axis and select the “Add as shredded text expression” option.

Numeric expression as a dimension

A numeric expression can be used as a dimension on a Cube. A simple banding dialog allows you to specify which bands you want to use in your analysis.

In this example we use the following expression to calculate the number of months since last booking:

Expression
Agemonths([Booking Date])

To access the simple banding dialog, right drag the expression onto a cube axis and select the simple banding option.

Enter the required numeric ranges into the freeform space provided and select OK. Click build to view results.

Cube showing Agemonths expression dimension with numeric banding applied