Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Setting selected value of what if parameter with code

Hi all,   I am using a "what if" parameter. User can enter a wide range of values. But the reasonable range depends on other slicers. To help user enter meaningful numbers, I'd like to reset the se...
  • Wimverh's avatar
    5 years ago

    It's possible to use a measure, as the default value, but it won't be represented in the marked box. 
    So you would need to put a card visual on top of the box, to show your value. 

    For resetting the value, after you change a slicer, I don't think it's possible. 

    You could use a bookmark, and then add a button to your report to reset the value.

     

    Sample measure for changing default (you have this already, this is your suggested value:

    MyDefaultValue = if(HASONEVALUE(Customer[CustomerGroup]),SWITCH(min(Customer[CustomerGroup]),"G01",15,"G02",30,20),29)

     Parameter Value (the last part, is where you add your default value, so the measure on top)

    Parameter Value = SELECTEDVALUE('Parameter'[Parameter], [MyDefaultValue])

     

    Sample file: https://dataploration.be/forumpost/WhatIfSample.pbix