How to Use Parameter in DAX Power BI
Tired of building static reports that only answer one question at a time? What-if parameters in Power BI can transform your dashboards from simple readouts into interactive forecasting tools, allowing you or your stakeholders to explore different business scenarios in real time. This guide will walk you through exactly how to create and use parameters in DAX for powerful what-ifs analysis and dynamic calculations.
So, What Exactly is a DAX Parameter in Power BI?
Think of a DAX parameter - often called a "What-If" parameter - as a variable you or your end-users can control directly from the report canvas, usually with a slider or a text input box. It's not a filter that changes your underlying data source. Instead, it creates a temporary, stand-alone value that you can reference within your DAX measures to dynamically alter calculations.
Imagine it like a dimmer switch for your data. The switch itself doesn't change the electricity coming into your house (your raw data), but it controls how bright the lightbulb is (the output of your calculations). By moving the dimmer switch, you can see the effect of different settings instantly.
This is different from parameters you create in Power Query. Power Query parameters are used to change the data that gets loaded into your model in the first place, like filtering for a specific region or modifying a data source URL. DAX parameters work after the data is loaded, operating entirely within your report's calculation layer.
Common use cases for what-if parameters include:
- Sales Forecasting: Modeling future revenue based on different monthly growth rate assumptions.
- Commission Calculations: Calculating a sales team's total commission by manually inputting different commission percentages.
- Pricing Analysis: Understanding the impact of a potential price increase (e.g., +5%, +10%) on total gross profit.
- Goal Setting: Setting a dynamic monthly sales target and tracking performance against it with a KPI visual.
Step-by-Step Guide: Creating Your First 'What-If' Parameter
Let's walk through a practical example. Imagine you're analyzing sales data and want to forecast your potential revenue for next month based on an adjustable growth rate. You want to give users a slider to select a growth rate between 1% and 20% to see how the forecast changes on the fly.
Step 1: Finding the 'New Parameter' Option
First, navigate to the Power BI Desktop report view. In the top ribbon, go to the Modeling tab. Look for the "Parameters" section and click on New parameter. From the dropdown, select Numeric range. This will open the "Parameter" configuration window, where you'll define the behavior of your interactive slider.
Step 2: Configuring Your Parameter
This dialog box is where you set up all the details. For our revenue growth scenario, let's configure it as follows:
- Name: Give your parameter a descriptive name. This will become the name of the new table Power BI creates. Let’s call it
Growth Rate Forecast. - Data type: Since we're dealing with percentages, choose Decimal number.
- Minimum: This is the lowest value on your slider. For 1% growth, we'll enter
0.01. - Maximum: The highest value. For 20% growth, we’ll enter
0.20. - Increment: This defines the steps the slider will "snap" to. For 1% increments, enter
0.01. - Default: The value the slider will be set to when the report loads. Let's start with a conservative 5% growth by entering
0.05.
Make sure the "Add slicer to this page" box is checked. This handy option automatically puts a visual slicer for your new parameter onto the current report page, saving you a step. Once you've filled everything in, click OK.
Step 3: What Power BI Creates for You
When you click OK, Power BI does two things in the background:
- It generates a new calculated table.
If you look in your Fields pane on the right, you'll see a new table named
Growth Rate Forecast. This table contains a single column (also namedGrowth Rate Forecast) that holds a series of values from your minimum to maximum, based on the increment you set. This is what populates the slicer. - It creates a DAX measure. Along with the new table, Power BI also creates a measure to capture the currently selected value from your slicer. The measure looks like this:
Growth Rate Forecast Value = SELECTEDVALUE('Growth Rate Forecast'[Growth Rate Forecast], 0.05)The SELECTEDVALUE() function does exactly what it sounds like: it returns the single value currently selected in the slicer. If no value is selected or multiple values are selected, it returns the optional "alternate result," which in our case is the default of 0.05 we set earlier.
This measure is the key! It's the bridge between the user's interaction (moving the slicer) and your calculations.
Putting Your Parameter to Work in a DAX Measure
Now that we have our Growth Rate Forecast Value measure, we can use it to build dynamic reports.
Step 1: Create a Base Measure
First, we need a simple measure for our current total sales revenue. This will be our baseline. Let's assume you have a sales table called 'Sales' with a column named 'Revenue'. Right-click on your sales table and select New Measure. Enter the following formula:
Total Revenue = SUM(Sales[Revenue])Step 2: Create a Dynamic Forecasting Measure
Next, we'll create the measure that uses our parameter. This measure will take the Total Revenue and increase it by the percentage selected on the slicer.
Create another new measure with this formula:
Forecasted Revenue = [Total Revenue] * (1 + 'Growth Rate Forecast'[Growth Rate Forecast Value])Let’s break it down:
[Total Revenue]is our base calculation.- We then multiply it by
(1 + 'Growth Rate Forecast'[Growth Rate Forecast Value]). The'1'ensures we keep our original revenue, and adding the parameter value provides the percentage increase. For a 5% selection, this becomes[Total Revenue] * 1.05. For a 10% selection, it becomes[Total Revenue] * 1.10, and so on.
Step 3: Visualize the Result
The final step is to see it all in action. Drag a Card visual onto your report canvas and add the new Forecasted Revenue measure to it.
Now, interact with the "Growth Rate Forecast" slicer that Power BI created for you. As you drag the handle, you’ll see the number in the Forecasted Revenue card update instantly. You’ve just created your first interactive what-if scenario!
To make it even more compelling, you could place a card with Total Revenue next to the Forecasted Revenue card, or create a column chart comparing the two values.
Practical Tips and Advanced Ideas
Creating a simple forecast is just the beginning. Here are a few tips to enhance your parameters.
Formatting Your Parameter's Display
The slider probably shows decimal values like 0.05 or 0.10. To make it more user-friendly, you can format the underlying column as a percentage.
In the Fields pane, select the Growth Rate Forecast column (the one with the column icon, not the calculator icon). Go to the Column tools tab at the top and change the Format from "General" to "Percentage". Now your slicer and any associated visuals will display clean-sounding percentages like 5% and 10%.
Using Parameters to Set Dynamic Goals
Instead of forecasting growth, what if you wanted to set a variable sales target? You could create a parameter called "Sales Target" with a range from $1,000,000 to $5,000,000 in increments of $50,000.
You could then build a KPI and "Actual vs. Target" visual, where your Total Revenue is the indicator and the Sales Target Value parameter is the target goal.
Combining Multiple Parameters
The real power comes from combining multiple what-if parameters. You could create one parameter for a 'Discount Percentage' and another for an expected 'Unit Volume Increase' due to that discount. Your final 'Forecasted Revenue' measure could then use both parameters to model a more complex scenario, helping the business find the sweet spot between discount generosity and sales volume.
Final Thoughts
Creating 'What-If' parameters is a fantastic way to level up your Power BI reports. It shifts your dashboards from being static, historical views to being forward-looking, interactive tools that empower users to explore possibilities and make better data-informed decisions. You’re giving your audience a way to ask their own questions directly within the report.
While mastering DAX parameters is a powerful skill, we know building detailed reports in tools like Power BI can be deeply time-consuming and comes with a steep learning curve. We built Graphed to skip all that manual work. Instead of wrestling with DAX measures and slicer configurations, you can just ask questions in plain English, like "forecast our revenue for next month with 5% growth" or "show me the impact of a 10% price increase on profits," and watch as a live dashboard is built for you in seconds. It connects to your business data automatically, turning hours of report building into a quick and simple conversation.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.