Cube: How do I use an Expression in a Cube?

Sometimes you may wish to use an expression in a cube. You can use it as a cube statistic. See Cube: How do I display multiple information in the Cube?

Firstly, use the Expression Editor to make an expression. In this example we will use the following expression:

Use an Expression as a Statistic

In this example we will use the following 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:

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.

Use a Text 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:

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

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

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.

Use a 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:

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.