What If Parameter in Power BI Date
Thinking about the future of your business shouldn't be limited to static reports of what’s already happened. With Power BI’s What-If parameter, you can build dynamic, interactive scenarios right into your dashboards, especially when you need to forecast based on time. This article breaks down how to use a date-based What-If parameter to transform your historical data into a powerful tool for planning and projection.
What Exactly Is a 'What-If' Parameter?
In simple terms, a What-If parameter is an interactive slicer in your Power BI report that isn't connected to your existing data through a relationship. Instead of filtering your data like a normal slicer, it creates a standalone table and a measure. When you adjust the slicer, it changes the value of that measure, which you can then use in other DAX formulas to simulate how changes could impact your business.
For example, you could create a parameter to ask questions like:
- "What if we increase our marketing budget by 15%? What happens to our projected ROI?"
- "What if we assume a product return rate of 8% instead of 5%? How does that change our net revenue?"
The parameter lets you, or anyone viewing the report, plug in different values for that 15% or 8% and instantly see the results. It's a very interactive way to model potential outcomes without needing to edit formulas or change the underlying data.
Why Use What-If Parameters with Dates?
Applying this "what-if" logic to dates opens up powerful forecasting possibilities. Reporting on the past is useful, but the most valuable insights often come from projecting into the future. By using a What-If parameter to control a number of days, weeks, or months, you enable your reports to answer time-based questions directly.
Here are some relatable scenarios where a date-based parameter shines:
- Sales Forecasting: "Show our projected revenue for the next 45 days based on our current sales velocity."
- Inventory Management: "What is our estimated inventory need 90 days from now if current trends continue?"
- Project Management: "How delayed will our project deadline be if we add 10 buffer days to the timeline?"
- Subscription Services: "Model our monthly recurring revenue (MRR) over the next 6 months assuming our current growth rate."
This approach moves your dashboard from being a rearview mirror to a forward-looking GPS, helping you navigate what's ahead.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Your Step-by-Step Guide to Creating a Date-Based What-If Parameter
Let's build a practical example: a sales forecast that projects revenue forward a variable number of days. For this, we’ll assume you have a 'Sales' table with an OrderDate and TotalSales column, and a separate 'Calendar' table connected to it.
Step 1: Set Up the What-If Parameter
First, we need to create the parameter that will generate our slicer and a backing measure.
- On the Power BI Desktop ribbon, navigate to the Modeling tab.
- Click on New parameter and select Numeric range.
- The 'Parameters' dialogue box will pop up. Fill it out as follows:
- Make sure the "Add slicer to this page" checkbox is ticked. Power BI will automatically add a handy slicer for your new parameter to the report canvas.
- Click OK.
After clicking OK, Power BI does two things in the background for you:
- 1. It creates a new calculated table: You'll see a 'Days to Project' table in your Fields pane. Its data is generated by a DAX formula you can see:
Days to Project = GENERATESERIES(0, 180, 1). This is simply a single-column table containing every whole number from 0 to 180. - 2. It creates a new measure: Power BI also creates a measure called 'Days to Project Value'. The formula for this is:
Days to Project Value = SELECTEDVALUE('Days to Project'[Days to Project], 30). This elegant little measure simply returns whatever value is currently selected on the slicer. If nothing is selected, it returns the default value (30 in our case).
Remember, this new table has no relationship to your Sales or Calendar tables. The magic happens next when we use our DAX formulas to connect them logically.
Step 2: Create a DAX Measure for Your Projection
Now, we need a single DAX measure that can show both our actual historical sales and our calculated projected sales. This makes it possible to show a continuous, seamless line on a line chart.
Right-click your 'Sales' table and select New Measure. Enter the following DAX formula:
Sales with Projection =
// This measure checks the date context. If it's in the past, it shows actual sales.
// If it's in the future (within our projection window), it calculates a projection.
VAR SlicerProjectionDays = [Days to Project Value] // Gets the current value from our slider
VAR LastDayInContext = MAX('Calendar'[Date]) // The current date on the visual's axis
// Find the last actual transaction date, unaffected by filters.
VAR LastActualTransactionDate =
CALCULATE(
MAX(Sales[OrderDate]),
ALL(Sales),
ALL('Calendar')
)
RETURN
// Part 1: Logic for historical data
IF(
LastDayInContext <= LastActualTransactionDate,
[Total Sales], // Your existing measure for total sales, e.g., SUM(Sales[TotalSales])
// Part 2: Logic for future (projected) data
IF(
LastDayInContext > LastActualTransactionDate
&& LastDayInContext <= (LastActualTransactionDate + SlicerProjectionDays),
// This is a simple projection model: the average daily sales from the past 30 days.
// You can make this calculation as simple or as complex as you need.
CALCULATE(
AVERAGEX(VALUES('Calendar'[Date]), [Total Sales]),
DATESINPERIOD('Calendar'[Date], LastActualTransactionDate, -30, DAY)
)
)
)Let’s break that down:
- The measure first checks if the date it's calculating for (
LastDayInContext) is on or before the last day we have actual sales data. - If it is, it just returns your standard
[Total Sales]measure. - If the date is in the future, it then checks if that date falls within our projection window (number of days selected on the slicer).
- If it does, it calculates a projection. In this example, we're using a simple moving average: the average daily sales from the 30 days leading up to our last actual sale. You could substitute this with a more sophisticated growth model or seasonality adjustment if you wanted.
Step 3: Visualize Your Projection
With an interactive slicer and a smart measure, it's time to build the visual that brings it all together.
- Select a Line chart from the Visualizations pane and add it to your report canvas.
- Drag your
'Calendar'[Date]field to the X-axis. - Drag the new
[Sales with Projection]measure to the Y-axis.
You should now see a line chart displaying your historical sales. To make the projection stand out, you might add a vertical line to mark today's date or format the line with conditional formatting rules.
Now for the best part: play with the "Days to Project" slicer you created. As you drag it, you’ll see the projection portion of your line chart extend and retract in real-time. You’ve just given your report users the power to perform their own forecasting on the fly.
Pro Tips and Common Scenarios
Once you’ve mastered the basics, you can expand on this technique in several ways.
Combine Multiple What-If Parameters
Don't stop at just one parameter. You can add a second one for a growth or decline percentage. For example, create a "Growth %" parameter (from -20% to +20%) and then modify your projection logic:
[Projection Logic] * (1 + [Growth % Value])
Now users can model both the duration and the rate of growth. How does our 60-day forecast look with a conservative 2% monthly growth versus an optimistic 5%?
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Use DAX for Dynamic Chart Titles
Make your charts even more informative by having their titles update based on the slicer's value. Create a new measure like this:
Dynamic Chart Title =
"Sales with a " & [Days to Project Value] & "-Day Projection"Then, go to your chart’s formatting options, find the ‘Title’ section, and use the ‘Conditional formatting’ (fx) button to select your new dynamic title measure. The title will now instantly reflect the projection period.
Differentiate Historic vs. Future Data Visually
A single line looks clean, but sometimes you want to clearly separate actuals from forecasts. Instead of one seamless measure, you can create two separate ones:
[Historic Sales]:IF(MAX('Calendar'[Date]) <= [LastActualTransactionDate], [Total Sales], BLANK())[Projected Sales]:IF(MAX('Calendar'[Date]) > [LastActualTransactionDate], [Projection Logic], BLANK())
Add both measures to your line chart. You can then format the 'Projected Sales' line as a different color or a dotted line to make the forecast visually distinct.
Final Thoughts
The "What-If" parameter, when combined with date logic, elevates your Power BI reports from being merely informational to being truly strategic tools. By following these steps, you can create dynamic views that empower your team to explore scenarios, plan for the future, and make data-driven decisions with confidence.
Ultimately, building reports shouldn’t feel like an endless battle with formulas and data wrangling just to see what might happen next. At Graphed, we’ve made scenario analysis and reporting as simple as asking a question. Instead of writing DAX, you can simply connect your data sources - like Shopify or Salesforce - and ask: "Project my sales for the next 90 days based on last quarter’s average." We build the interactive dashboard for you in seconds, pulling live data so your insights are always current, allowing anyone on your team to move from data to decisions without the technical overhead.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.