Skip to content

MDX() ​

Use MDX() when the rows or columns in a report should be selected dynamically. You can also run a full MDX query or reuse an existing IBM Planning Analytics cube view.

Syntax ​

text
=MDX(cubeName, rowElements, columnElements, contextFilters, options)
=MDX(mdxQuery, options)
=MDX(cubeNameAndView, options)
  • cubeName — The cube to read, such as "Revenue". Use ConnectionName::CubeName to select another connection.
  • rowElements — A dimension expression, or a horizontal range containing row expressions.
  • columnElements — A dimension expression for dynamic columns, or a range of cells for fixed columns.
  • contextFilters — A cell or range containing the elements that apply to the whole report.
  • options — Output flags. Combine them in one string, such as "FS".
  • mdxQuery — A complete MDX query, supplied as text or a cell reference.
  • cubeNameAndView — The cube and view names in cubeName^viewName format.

Options ​

FlagWhat it does
FReturn values with the formatting defined in IBM Planning Analytics.
SWrite results as static values.
GShow repeated row labels once for each group.
IIndent element names by hierarchy level. Use I for one space per level, II for two, or III for three.
RInclude empty rows when TeamOne builds the query from row and column expressions.
CInclude empty columns when TeamOne builds the query from row and column expressions.
HHide column headers.
ZShow zeroes in place of blanks.
XSkip the formula when TeamOne recalculates the sheet. Put X in the fifth argument, including when the first argument is a query or view.

Dynamic rows and columns ​

Give each axis a dimension and a set expression. Combine dimensions on the same axis with * (space, asterisk, space).

text
dimName^setExpression
dimName^hierName^setExpression
dimName^setExpression~aliasName
dimName^setExpression~alias=aliasName~expandAbove

Use the hierarchy form to select an alternate hierarchy. Specify an alias to show it in the results. By default, the formula uses principal element names. The expandAbove option displays children above their consolidations. See aliases and subset options.

For example, this axis combines regions and versions.

text
Region^$ROOTS>>children~Description * Version^Actual;Budget

Put the row and column expressions in cells if you want to edit the layout without changing the formula. In the example below, B2 holds the cube name, C4 and C5 hold the expressions, and C3:F3 holds the filters.

text
=MDX(B2, C4, C5, C3:F3, "FS")

MDX formula with row and column expressions stored in separate cells

See the dynamic rows and columns example.

Dynamic rows and static columns ​

Use a set expression for the rows and select a range in the sheet for the column headers. TeamOne identifies the column dimensions from the values in that range, as it does for TEAMONE(). The column labels you enter serve as the headers.

MDX formula that generates rows while using a range of fixed column headers

See the fixed columns example.

Run a full MDX query ​

Paste the complete query from Planning Analytics Workspace into a cell, then pass that cell to MDX(). For example, if the query is in B25, enter:

text
=MDX(B25)

MDX formula running a complete query stored in a cell

Load a cube view ​

Pass the cube and view names together as cubeName^viewName. For example, this loads the Revenue by channel view from the Revenue cube.

text
=MDX("Revenue^Revenue by channel")

MDX formula loading a saved Revenue by channel view

See the full query and cube view examples.