Forum Discussion
Setting selected value of what if parameter with code
- 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
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