Version 2021

Using Prompts and ApplySimple Statements

Using the ApplySimple function, you can include prompts in your MDX to provide dynamic analysis on your MDX cube data. For basic information and examples of the ApplySimple function, see the Functions Reference.

The example below shows the basic structure of an ApplySimple statement to create metrics with custom MDX:

ApplySimple("MDX expression with placeholders for objects",object0,object1,...,objectN)

A simple application of this technique is to use a constant value prompt in your project as a multiplier of metric data:

ApplySimple("([Measures].[Total Sales] / #0)" ,?valueprompt)

In the example syntax above, #0 is a placeholder in the MDX expression for the value prompt. The syntax for including a prompt as an object to replace a placeholder is ?promptname.

You can also use this technique with the conditional metrics techniques. For example, rather than always returning the revenue data for electronics, you can allow users to choose what category to view revenue for. To provide this analysis to users, you can include an element list prompt on the Category attribute of the MDX cube:

ApplySimple("([Measures].[Revenue],#0)", ?elementlistprompt)

Related Topics

Creating Metrics from MDX Cube Data

How to Build Analysis into Metrics with Custom MDX

Using Prompts within MDX Cube Metrics