Introduction
Measure parameters open an opportunity for end-users to change the result of a measure by changing the parameter values.
Some use cases for this are what-if analysis, multi-currency display, custom date ranges, and more.
In this article, you'll learn how to define a measure with parameters, link the parameters to workbook variables, and allow end-users to change the measure results by changing the variable.
Defining a measure with parameters
Open the new measure dialog, done either in the data-modeling screen in the semantic view or from a visualization properties panel.
Adding formula parameter
A formula parameter adds a new block to the measure with a math operation.
The parameter is found at the bottom of the aggregations drop-down list.
After adding the parameter, there are two values that need to be defined,
Default numeric value: In this case, you can only use numeric values.
Name - give the parameter a meaningful name.
* If you want to use the same parameter multiple times, you need to make sure you
use the same name and default value.
Adding filter parameter
A Filter parameter is added as part of the process of defining a filter to a measure.
Click on the Funnel Icon in the desired formula block, select the field to apply the filter to and the operator.
From the drop-down, select the parameter, give it a default value, and give it a name.
Save the measure.
Using a measure with parameters in a Visualization
Defining the parameter value in a visualization
When a measure with a parameter is added to a chart, a new section in the measure properties will appear. the measure properties are in the Data tab of the properties panel.
There are three options to set the parameter value:
Default - when calculating the measure value, the engine will always use the default value set by the measure creator.
Static Value - A manual valve, set in the properties panel. The engine will always use this value.
Variable - Tie the parameter to a variable. The engine will use the current value of the variable when calculating the measure value.
This method allows end-users to dynamically change the measure result.
Read this article to learn more about variables and how to set them upIn the example below, the parameter is tied to a variable.
Changing a variable value in a workbook
There are different methods to change a variable value dynamically in a workbook.
Input box \ input list - add the variable to one of these objects to allow users to change the variable's value.
This method is best when a user can select from various options.Button and Actions - The variable value is changed by a user clicking on a button.
This method is best when there is a limited set of options and there is a need to change more settings than just the variable value.
For example, the action block below will change the variable value and the chart title.
Read this article to learn more about actions.This is a live example of how the button above works.