cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BastiaanBrak
Helper IV
Helper IV

What is intended behaviour for default value of 'What if' parameter?

hi all, I'm wondering how the default value that can be set for a 'What if' parameter is supposed to work. For example:  I've set up a What If parameter with values from 0 to 20 with increments of 1 and default value of 5. When I change the value in the slicer to 10, then close and re-open the report, the slicer does not re-set to 5. Also, suppose I change the slicer to 0, then publish the report; again it is the value set by me (0 in this case) rather than the 'default value' that is applied.

 

So where does default value come in?

Power BI test report available here if needed: https://we.tl/t-UrWhC1GT5B

 

Thanks, Bastiaan

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @BastiaanBrak

 

Using your example, when a What If parameter is created, Power BI creates:

  1. A table containing the allowed parameter values:
    YearMultiplier = GENERATESERIES ( 0, 20, 1 )
  2. A measure returning the selected parameter value:
    YearMultiplier Value = SELECTEDVALUE ( YearMultiplier[YearMultiplier], 5 )

The default value appears as the second argument of SELECTEDVALUE, and is returned if there is not exactly one value of YearMultiplier[YearMultipler] visible in the current filter context.

 

For example if multiple selections (or no selections) are made on a slicer for YearMultiplier[YearMultiplier], then [YearMultiplier Value] = 5.

 

The very first time a slicer is added for a What If Parameter column, it is an unselected state, so in your example [YearMultipler Value] = 5. You can test this by deleting the slicer and adding it again, and putting [YearMultiplier Value] on a card or other visual.

 

Regards,

Owen


Owen Auger

Did I answer your question? Mark my post as a solution!

My Blog
Connect on Twitter
Connect on LinkedIn

View solution in original post

8 REPLIES 8
OwenAuger
Super User
Super User

Hi @BastiaanBrak

 

Using your example, when a What If parameter is created, Power BI creates:

  1. A table containing the allowed parameter values:
    YearMultiplier = GENERATESERIES ( 0, 20, 1 )
  2. A measure returning the selected parameter value:
    YearMultiplier Value = SELECTEDVALUE ( YearMultiplier[YearMultiplier], 5 )

The default value appears as the second argument of SELECTEDVALUE, and is returned if there is not exactly one value of YearMultiplier[YearMultipler] visible in the current filter context.

 

For example if multiple selections (or no selections) are made on a slicer for YearMultiplier[YearMultiplier], then [YearMultiplier Value] = 5.

 

The very first time a slicer is added for a What If Parameter column, it is an unselected state, so in your example [YearMultipler Value] = 5. You can test this by deleting the slicer and adding it again, and putting [YearMultiplier Value] on a card or other visual.

 

Regards,

Owen


Owen Auger

Did I answer your question? Mark my post as a solution!

My Blog
Connect on Twitter
Connect on LinkedIn

View solution in original post

Hi @OwenAuger ,

 

What if the case i want to show the [YearMultiplier Value] = 5 value in slicer itself, Is it possible to show the default value as 5 when i open the report? I am able to see the value in card visual, but my requirement is to show the 5 value in slicer?

@prakash11440278 

You can select that particular value on the slicer in Power BI Desktop, then save & publish. 

Does that work for you?


Owen Auger

Did I answer your question? Mark my post as a solution!

My Blog
Connect on Twitter
Connect on LinkedIn

Hi @OwenAuger ,

Thanks a lot for your reply.

I cannot add the "YearMultiplier Value" measure in filter visual directly because the slicer expects the column "YearMultiplier". If i want to drag the measure "YearMultiplier value" in the slicer how we need to accomplish the requirement. Below in the screen shot where the static value 5555 (measure) should be populate in that slicer as single value by default when i open the report.

 

prakash11440278_0-1623418318878.png

 

Hi @OwenAuger ,

Any upadte on my requirement. Is it possible to show the default value in slicer as single value automatically when we open the report. Is it possible using card visual but how to show in slicer?

Were you able to determine a solution? Based on a value in the dataset, I want to set one of the slicer values as selected (checked) when the report is called/opened in the service portal

Hi again @prakash11440278 - just clarifying, what I meant from my previous post is that you can select the desired default value on the slicer (by dragging or entering it), then save the report with this selection made and publish.

Then users who view the report will see this selection when they open the report (unless they change the slicer selection themselves).


Owen Auger

Did I answer your question? Mark my post as a solution!

My Blog
Connect on Twitter
Connect on LinkedIn

hi @OwenAuger, thanks for that! Seems to me it could be called (even if just in my head) an 'initialisation value', rather than 'default value'?!

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors