Where Function in Power BI
Ever wish you could add interactive sliders to your reports to see how changing one number impacts everything else? That's exactly what WHAT IF parameters in Power BI are for. They let you, and your stakeholders, forecast outcomes and explore different scenarios on the fly without needing to change the underlying data. This article will show you exactly how to create and use these parameters to make your reports much more dynamic and insightful.
What is a "WHAT IF" Parameter in Power BI?
A WHAT IF parameter isn't a single DAX function like you might find in Excel. Instead, it's a powerful feature that lets you add a variable into your reports that can be dynamically changed with a slicer. Think of it as a "control knob" for your data visuals.
When you create a WHAT IF parameter, Power BI actually does two things for you in the background:
- It creates a new calculated table. This table contains a single column of values covering the range you define (e.g., all numbers from 1 to 100). It uses the
GENERATESERIES()DAX function to do this. - It creates a new measure. This measure captures the single value currently selected on the slicer using the
SELECTEDVALUE()DAX function.
You can then use this special measure as a placeholder in your other calculations. As you move the slider, this measure's value updates, and Power BI recalculates any formulas that depend on it in real-time. This allows you to model scenarios and see the immediate impact of changing assumptions - like a price increase, a discount percentage, or a growth target.
Common Scenarios for WHAT IF Parameters
The real power of WHAT IF analysis comes from applying it to real-world business questions. It turns a static, historical report into a forward-looking decision-making tool. Here are a few common ways businesses use them:
- Sales Forecasting: "What would our projected revenue be next quarter if we increased our average deal size by 8?"
- Pricing Analysis: "How will a price increase between 5% and 25% affect our total profit margin per product line?"
- Marketing Budget Allocation: "If we apply a 15% budget cut to our campaigns, what would the estimated impact be on our cost per acquisition?"
- Financial Modeling: "How does changing the interest rate assumption by 0.5% impact our loan repayment schedule over the next 5 years?"
- Operational Planning: "What is the new production target if we assume a 3% increase in production efficiency?"
Basically, any time you find yourself saying "What would happen if..." you're looking at a perfect opportunity for a WHAT IF parameter.
How to Create a WHAT IF Parameter: Step-by-Step
Let's walk through building one from scratch. Imagine we have a sales report and we want to create a parameter to model the impact of a potential discount on our total revenue.
Scenario: We want to see how a discount ranging from 0% to 30% would affect our overall sales figures.
Step 1: Open the WHAT IF Parameter Menu
In Power BI Desktop, navigate to the Modeling tab in the top ribbon. Within this tab, find the "Parameters" section and click on New parameter. If you only see "New parameter," click it, and then select "Numeric range."
Step 2: Configure Your Parameter
A dialog box will pop up with several fields to configure. Here's what each one means and how we'll set it up for our discount example:
- Name: This is the name for both the generated table and the slicer's title. Let's call it
Discount %. - Data type: Choose the type of number you need. Since a discount is a percentage, Decimal number is the best choice. For something like "number of new hires," you'd use a Whole number.
- Minimum: The lowest value for your slider. For our discount, this will be
0(representing a 0% discount). - Maximum: The highest value for your slider. A 30% discount can be represented as
0.30. We'll set the max to this value. - Increment: This sets the step value for how much the number changes each time the slider moves. Let's set it to
0.01so we can adjust the discount by single percentage points. - Default: The value the slicer will be set to when the report loads. Let's start with
0. - Add slicer to this page: Keep this box checked. Power BI will automatically add a pre-formatted slicer for your new parameter to the current report page, saving you a step.
Once you've filled everything in, click OK.
Step 3: See What Power BI Created
After clicking OK, two things instantly appear:
- A slicer on your report canvas. You can now drag the slider or type a number directly into the box.
- A new table and measure in your Data pane on the right-hand side.
If you look at the DAX formulas, Power BI just generated these for you:
- A calculated table named 'Discount %', with a single column also named 'Discount %', built with this formula:
- A measure within that table called 'Discount % Value', using this formula:
This Discount % Value measure is the key. It holds the currently selected value from the slicer. This is the variable we will use in our calculations.
Putting Your WHAT IF Parameter to Work in Measures
Now for the fun part: integrating the parameter into our calculations. Let's assume you already have a basic measure that calculates total sales revenue:
Total Sales = SUM(Sales[Revenue])Our goal is to create a new measure that calculates what the revenue would be after applying the discount selected on our slicer.
Step 1: Create a New Measure
Right-click on your Sales table (or wherever you keep your key measures) in the Data pane and select New measure.
Step 2: Write the DAX Formula
We'll name this measure Projected Sales After Discount. The logic is simple: take the total sales and decrease it by the discount percentage.
The formula looks like this:
Projected Sales After Discount =
[Total Sales] * (1 - 'Discount %'[Discount % Value])Let's break it down:
[Total Sales]is our existing measure.'Discount %'[Discount % Value]is the dynamic measure Power BI created for us. It returns the value from the new slider (e.g., 0.10 for a 10% discount).(1 - 'Discount %'[Discount % Value])calculates the remaining portion after the discount. For a 10% discount, this would be(1 - 0.10), or0.90.- So, the full measure multiplies the total sales by this amount to give us the final discounted sales amount.
Step 3: Visualize the Result
Now you can see it all in action. Add a new Card visual to your report and drag your new Projected Sales After Discount measure into it. Place it next to another card showing the original Total Sales.
As you move the "Discount %" slicer, you will see the Projected Sales After Discount value change instantly. You've successfully built an interactive scenario analysis tool!
An Advanced Tip: WHAT IF with Text Values
The built-in "New parameter" feature only works for numeric ranges. But what if you wanted to model scenarios based on text categories, like "Aggressive Growth," "Baseline," and "Conservative Growth"?
You can replicate the WHAT IF behavior manually by creating a disconnected table.
- Create a Manual Table: Go to the Home tab and click Enter data. Create a table with one column, maybe named Scenario Type, and add your text values as rows ("Aggressive," "Baseline," "Conservative"). Give the table a name, like "Scenarios", and click Load.
- Create a Slicer: Add a slicer to your report using the new Scenario Type column.
- Write a SWITCH Measure: Now, write a measure that uses
SELECTEDVALUEto get the chosen scenario and aSWITCHorIFstatement to apply the corresponding logic.
Projected Growth Revenue =
VAR SelectedScenario = SELECTEDVALUE(Scenarios[Scenario Type], "Baseline") // Default to "Baseline"
RETURN
[Total Sales] * SWITCH(
TRUE(),
SelectedScenario = "Aggressive", 1.25, // 25% growth
SelectedScenario = "Conservative", 1.05, // 5% growth
1.10 // 10% growth for "Baseline"
)This approach gives you ultimate flexibility, letting you switch between complex calculation models, not just simple value changes, with the click of a button.
Final Thoughts
WHAT IF parameters transform static Power BI reports into interactive dashboards that invite exploration. They empower business users to test their own assumptions and understand the potential impact of their decisions without needing a data analyst to rerun the numbers. It's an essential feature for anyone involved in forecasting, budgeting, or strategic planning.
For even faster analysis, tools like Graphed are making this kind of "what if" analysis even simpler by using AI. Instead of building parameters and measures manually, we've designed Graphed so you can directly ask questions in plain English like, "Forecast our revenue for the next six months if our ad spend increases by 20%." The system handles the complex calculations and builds the visualization for you, turning hours of report building into a 30-second conversation with your data.
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.