In Power BI, you can create and use What-if parameters for your report, interact with the parameter as a slicer, and visualize key values in your report.
In this blog, I’ll be showing how to create a what-if parameters & explain a use case where this can come handy.
Blog Structure:
- Intro to the Dataset
- Creating What-if Parameters
- Using What-if Parameters
- Conclusion
Intro to the Dataset
For this example, I have taken a sample sales prediction data which predicts the sales based on the conditions present in columns ‘RA’, ‘A’ & ‘SB’.
I’ll not be going into much details about the model itself but will rather be concentrating on the report we’ll be creating in Power BI. We need to use the above conditions as parameters to provide a smooth interface in the Power BI report. So, let’s get started.
Creating What-if Parameters
To create a what-if parameter, select New Parameter from the Modeling tab in Power BI Desktop.
For this example, I have created 3 parameters representing the columns ‘RA’, ‘A’ & ‘SB’ and set all their data type to Whole number. For all the parameters, the Minimum value is one & the Maximum is ten. I’ve set the Increments to 1. That’s how much the parameter will adjust when interacted with in a report.
You may notice that in addition to creating the parameter, creating a what-if parameter also creates a measure, which you can use to visualize the current value of the what-if parameter.
Using What-if Parameters
Now let’s create a measure which will be a simple Sum of the Sales dependent on the 3 newly created parameters.
Next, we will create the visualizations. To start, create 3 slicers by dragging the columns generated in each What-if parameter to the visualizing canvas.
Then, create a visual with the measure that we created in the previous step. In our case, a card.
Here’s how the final report looks like:
As we move the sliders in each of the parameters, the Sales will reflect the change.
Conclusion
What-if parameters allow the users to interact with the reports in a way that a normal slicer doesn’t allow. What-if parameters can be used in various situations to handle different issues as well.
Karan Nair
Team Lead – Data Analytics
Addend Analytics
Author By
Gaurav Lakhotia
Gaurav holds an MBA in Business Analytics. As a data geek and avid learner, he has earned accolades including Microsoft Certified Data Analyst, Microsoft Certified Azure Administrator, and active Power BI Community contributor. He is also a Microsoft Certified Trainer. With critical thinking and project delivery skills, he strives to achieve customer delight in Data Analytics projects. Gaurav loves travelling with friends when he is not busy working on data.