Forum Discussion
How to add numeric input parameter in PowerBI
Hello Anonymous
I am looking to add a numeric input parameter in PBI. It is does not belong to any dataset as well as there is no numeric range for it. It should be just a simple input parameter based on it's value need to apply the summation/multiply to get the result.
Hi,
Here's a step-by-step guide to help you set it up:
Create a What-If Parameter:
- Go to the Modeling tab in Power BI Desktop.
- Click on New Parameter and select What-If Parameter.
- In the dialog box, set the following:
- Name: Give your parameter a name, e.g., "Input Parameter".
- Data Type: Select Whole Number or Decimal Number based on your requirement.
- Minimum and Maximum: Set these to a wide range if you don't have specific limits.
- Increment: Set this to 1 or any other value that suits your needs.
- Default Value: Set an initial value for the parameter.
- Click OK. This will create a new table with the parameter values and a slicer for the parameter.
Use the Parameter in Calculations:
- You can now use this parameter in your DAX calculations. For example:
Result = SUM('YourTable'[YourColumn]) * SELECTEDVALUE('Input Parameter'[Input Parameter])Add the Slicer to Your Report:
- Drag the newly created parameter slicer to your report canvas.
- Users can now adjust the parameter value using the slicer, and your calculations will update accordingly.
- You can now use this parameter in your DAX calculations. For example:
Hi hemantprajapati ,
Whatever Anonymous suggested for data input into the measure can be done from Power BI Desktop only.
I would go with what Kaviraj11 suggested. WhatifParameters would be the right thing to go.
If you are worried about limiting to a certain number, then you should probably give a higher number that is likely not limiting the user from what they need. You can also swith off the slider to give them the feel of a input box. There is also a text box slicer in the custom visual that you can use for this purpose. This Text Box slicer also needs a column of values at the backend
However, be aware, what if parameters will create a calculated table at the backend which could be very big if you are going to give an extremely big number as your MAX value.
The Below are the screeshots
slicer wIth slider swithed off
Text Box slicer custom visual
Regards,
7 Replies
- Kaviraj11Solution Sage
Hi,
Here's a step-by-step guide to help you set it up:
Create a What-If Parameter:
- Go to the Modeling tab in Power BI Desktop.
- Click on New Parameter and select What-If Parameter.
- In the dialog box, set the following:
- Name: Give your parameter a name, e.g., "Input Parameter".
- Data Type: Select Whole Number or Decimal Number based on your requirement.
- Minimum and Maximum: Set these to a wide range if you don't have specific limits.
- Increment: Set this to 1 or any other value that suits your needs.
- Default Value: Set an initial value for the parameter.
- Click OK. This will create a new table with the parameter values and a slicer for the parameter.
Use the Parameter in Calculations:
- You can now use this parameter in your DAX calculations. For example:
Result = SUM('YourTable'[YourColumn]) * SELECTEDVALUE('Input Parameter'[Input Parameter])Add the Slicer to Your Report:
- Drag the newly created parameter slicer to your report canvas.
- Users can now adjust the parameter value using the slicer, and your calculations will update accordingly.
- You can now use this parameter in your DAX calculations. For example:
- hemantprajapatiMicrosoft Employee
Thanks Kaviraj for quick response. I have implemented the steps. However, I do not have any range. Is there a way to avoid the range ?
- AnonymousNot applicable
Thanks for the reply from Kaviraj11 , please allow me to provide another insight:
Hi, hemantprajapati
If the parameter does not meet your needs, I suggest directly creating a measure as a parameter:
1.Regarding the requirement for no numerical range, once you input the number, it will display a fixed value regardless of where it is placed in the visualisation object.
2.For the requirement of not belonging to any dataset, you can achieve this by creating a calculation group and then creating a measure within the calculation group. This perfectly meets the requirement, doesn't it?
3.You need to be able to directly reference multiplication and division, which can be achieved by the measure itself.
4.For more details, please refer to:
Calculation groups in Analysis Services tabular models | Microsoft Learn
Tutorial: Create your own measures in Power BI Desktop - Power BI | Microsoft Learn5.Calculation tables are also a good option.
num = DATATABLE( "vlaue", INTEGER, { {1} } )
Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.