This post is also available in:
Deutsch
I like working pretty much with the what-if parameter in Power BI. With the help of this, it is possible to run through corresponding scenarios in a very fine-grained manner. What would my operating result look like if I can increase my sales by a factor of 2? How would it look with 1.5? And how about 2.35? I am aware that these increases are extremes. But with the what-if parameter, such evaluations go very easily with a single slider.
Problem the what-if parameter does not work, the exact number cannot be set
However, there is occasionally the case that exact values cannot be set. Let’s take the case just mentioned as an example. I would like to evaluate the development of my sales, accurate to 0.01 points. Accordingly, I create a what-if parameter:

As range I would like to be able to select from -20 to 20 and the individual values should increase by 0.01 points:

Now when I try to adjust the slicer of the what-if parameter to 1, 1.5 or 2.35 something strange happens, I don’t get the slicer set exactly to the value I want:

Reason: Limitation to 1002 values per slicer
What is the reason that I cannot select exact values? Let’s first look at the generated table to see if the values are available at all. The parameter creates a table with the GENERATESERIES function. With a granularity of 0.01, we would need 100 values for a whole number. Since we cover the range from -20 to 20, this would be 40 x 100 = 4,000 individual values. This also is provided by the table:

Therefore, it is not the table that is to be blamed. Let’s take a look at the generated DAX code with the Performance Analyzer:

The DAX code of the slicer looks like this:
// DAX Query
DEFINE
VAR __DS0Core =
VALUES('SalesGrowth'[SalesGrowth])
VAR __DS0BodyLimited =
SAMPLE(1002, __DS0Core, 'SalesGrowth'[SalesGrowth], 1)
EVALUATE
__DS0BodyLimited
ORDER BY
'SalesGrowth'[SalesGrowth]
When we execute the query, we immediately notice the problem. The entire series is no longer displayed. There are gaps here compared to the original table:

If we take a look at the DAX Query, we can immediately see why this is happening. The following line is to be blamed:
VAR __DS0BodyLimited = SAMPLE(1002, __DS0Core, 'SalesGrowth'[SalesGrowth], 1)
The slicer limits the number of values to 1002 individual values! These are selected with the SAMPLE function in the selected range evenly distributed.
Ways to work around that
If you want to work around that, there are a few approaches.
1. restrict table to 1,002 values
The first option is to limit the data set to 1,002 values. In our case, this would be possible by restricting the granularity to one decimal position:

This way you will get only 400 values instead of 4,000 and the slicer can display all of the corresponding values. However, you have to restrict the granularity a bit to stay within the 1002 line limit:

2. modification of the slicer
Another option would be to adjust the slicer. For example, as a list or dropdown, the slicer will display the entire list of all values:

Also, the slicer can be adjusted to a “Less than or equal to” or “Greather than or equal to” slicer:

The entire range between the start and end values is then automatically displayed. Consequently, the individual steps that we would actually have liked to see are lost under certain circumstances.
For example, if I wanted to increase the slicer in increments of 5, this variant would provide all numbers between the start and end values and not in increments of five. In addition, the formula of the measure to be evaluated must be adjusted to MAX or MIN of the respective slicer, instead of SELECTEDVALUE as we had it before. Also, the start and end area are always displayed here in the slicer itself, which is probably undesirable according to the scenario.
Conclusion
The what-if parameter is still, from my point of view, one of the best ways to represent changes in a scenario. However, one must be aware of the limitations in the number of values on 1002 lines if one wants to select specific values. From my point of view, a note in Power BI would be a good solution here.
This was great Denis! You should do a YouTube video on this as I have to think many many people have experienced this problem. It’s frustrated me for a year before I found, and now understand, what the heck is going on!
There is another workaround that I was able develop. If your parameters are large and very granular you can add another column to the parameter table which would contain your parameter enclosed by any text character, for example ($100000K). Then your measure could be Value= VALUE(SUBSTITUTE(SUBSTITUTE(SELECTEDVALUE(PARAMETER),”$”,””),”K”,””)). Then instead if using the filter visual, you could use the search visual and type the parameter as $100000K and press enter. I know there are additional steps to this and that you will not have the dial functionality, but at least you would get rid of the start and end area of the filter visual and input specific numbers at a very granular level.
Hope this helps!
Hey Francisco,
that’s also a good proposal, but as far as I understand it still wouldn’t be possible to get the specific granular amount. But at least round numbers.
Thank you and best regards
Denis
Hi Denis,
I want you to know that I really like the method of explaining this problem we encountered in Power BI. I was also working on finding a solution to this issue. By creating a new table, I have developed a method that will both solve the performance problem and ensure that all values are reflected correctly without creating “what if parameters”. I wanted you to know that I also referenced your work in my post, since you explained the exact cause of the problem.
The work you have done has been very useful for me to understand the reason for the error, I hope my solution method will be useful for you too 😉
https://medium.com/@ezginazaslankara/the-solution-of-unable-to-input-number-parameter-in-power-bi-9876d8358587
Hey Ezgi,
thank you for the feedback and for mentioning my post in your article 🙂
I also like your approach to create the table upfront and then use the “Greather than or equal to” method.
Best regards
Denis
Hi Denis. Thank you for this. I want to go with the 2nd solution but, unlike a normal slicer, it doesn’t look like you can add a search bar this way. Any ideas for a workaround make the dropdown searchable?
Hey Jeremy,
unfortunately, that is true.
When the field is from the type whole number or decimal number, it’s not possible to add a search box. You could make the column a type text or add a calculated column from the type text and ust it for the slicer.
This way you can add a search field.
Best regards
Denis