Creating a “magic visual” in Power BI using new parameters, Field Parameters and Numeric Range Parameter (link to the official Microsoft site here ) involves combining field parameters and numeric range parameters to allow dynamic and interactive report features. Here’s a step-by-step guide to creating such a visual:
Step 1: Enable Field Parameters
- Enable Field Parameters:
- Go to
File>Options and settings>Options. - Under
Preview features, checkField parameters. - Restart Power BI Desktop.
Step 2: Create a Field Parameter
- Create the Field Parameter:
- In the
Modelingtab, selectNew parameter>Fields. - Name the parameter (e.g.,
Dimension Selector). - Add the fields you want users to be able to switch between (e.g.,
Sales,Profit,Quantity). - Click
Create.
- Use the Field Parameter in a Visual:
- Drag the newly created
Dimension Selectorto the Values area of a visual (e.g., a bar chart or line chart). - Power BI will create a slicer for the field parameter by default, allowing users to switch between the fields.
Step 3: Create a Numeric Range Parameter
- Create the Numeric Parameter:
- In the
Modelingtab, selectNew parameter>Numeric range. - Name the parameter (e.g.,
Threshold Selector). - Set the data type (e.g.,
Whole numberorDecimal number). - Define the minimum value, maximum value, increment, and default value (e.g., Minimum: 0, Maximum: 100, Increment: 1, Default: 50).
- Click
Create.
- Use the Numeric Parameter in a Visual:
- Drag the
Threshold Selectorparameter to the report canvas. It will appear as a slicer. - Use this parameter in DAX measures to dynamically filter or adjust data.
Step 4: Create DAX Measures for Dynamic Filtering
- Create a DAX Measure Using the Numeric Parameter:
- Create a new measure that uses the numeric parameter to filter data. For example:
DAX Sales Over Threshold = CALCULATE( [Total Sales], [Total Sales] > SELECTEDVALUE('Threshold Selector'[Threshold Selector]) ) - This measure calculates the total sales that are above the selected threshold.
- Add the Measure to a Visual:
- Add the
Sales Over Thresholdmeasure to a visual (e.g., a card or table) to display the dynamically filtered results.
Step 5: Combine Field and Numeric Parameters in a Visual
- Create Combined Visuals:
- Use both the
Dimension Selectorand theThreshold Selectorin your visuals. - For example, create a chart that displays sales, profit, or quantity based on the selected dimension, and filters the data based on the selected threshold.
- Example Chart Setup:
- Add a bar chart to the report canvas.
- Drag the
Dimension Selectorparameter to the Values area. - Drag the
Threshold Selectorparameter to a slicer on the canvas. - Create a DAX measure that combines both parameters for dynamic data filtering:
DAX Dynamic Measure = SWITCH( SELECTEDVALUE('Dimension Selector'[Dimension Selector]), "Sales", CALCULATE([Total Sales], [Total Sales] > SELECTEDVALUE('Threshold Selector'[Threshold Selector])), "Profit", CALCULATE([Total Profit], [Total Profit] > SELECTEDVALUE('Threshold Selector'[Threshold Selector])), "Quantity", CALCULATE([Total Quantity], [Total Quantity] > SELECTEDVALUE('Threshold Selector'[Threshold Selector])) )
- Add the Combined Measure to the Visual:
- Add the
Dynamic Measureto the Values area of the bar chart. - The chart will now dynamically update based on the selected dimension and threshold.
Step 6: Test and Refine
- Test Interactivity:
- Test the slicers and visuals to ensure they respond correctly to the field and numeric parameter selections.
- Make adjustments as needed to improve performance and user experience.
- Refine Visuals:
- Ensure visuals are clear and easy to interpret.
- Add titles, labels, and tooltips to enhance user understanding.
Final Notes
By following these steps, you create a Power BI “magic visual” that dynamically updates based on user-selected fields and numeric ranges, providing a highly interactive and customizable reporting experience. This approach leverages the power of field and numeric range parameters to offer flexible and insightful data visualizations.
Another very informative page on this topic is:
Fields parameters in Power BI – SQLBI
Have fun!!!

Leave a comment