Forum Discussion
To change what if parameter value based on slicer
Hi all,
I am currently building a dashboard and have landed in this situation. I have a slicer, and based on the slicer value I want to change the value of what-if parameter.
Forex- I have a slicer on Categories with 2 options A and B. If I select A, the whatif parameter i.e Cvalue should be 8000 and if I select B the value should change to 4000. I f I select B, the whatif param should generate a series from 500 to 9000 with a step of 100 (Cvalue = GENERATESERIES(500, 9000, 100)). Is it possible to have one what-if parameter with 2 conditions?
My current whatif parameter just for A category-
Desired-
I also have a reset button, that resets to the default value. It was working fine for one value but since now I have a slicer the reset button should be like - if A is selected the default value should be set to 8000 and if B is selected the default value should be 4000.
Further, the what-if param is used in DAX measure-
Std Cash = CALCULATE(SUM(Table[Num]) * 'Cvalue'[Cvalue] * 0.01)
I am attaching sample data as well.
| Date | Com | Num | RC% | Categories |
| 03/01/2020 | ABC | 6.016 | 14 | A |
| 03/01/2020 | BCD | 6.097 | 5.5 | A |
| 03/01/2020 | C | 6.540 | 10 | A |
| 03/01/2020 | D | 7.090 | 15 | A |
| 03/01/2020 | E | 6.780 | 30 | A |
| 03/01/2020 | F | 5.905 | 16 | A |
| 03/01/2020 | G | 7.119 | 30 | A |
| 05/02/2020 | C | 6.540 | 10 | A |
| 05/02/2020 | E | 6.780 | 30 | A |
| 05/02/2020 | F | 5.905 | 16 | A |
| 05/02/2020 | ABC | 6.016 | 14 | A |
| 05/02/2020 | BCD | 6.097 | 5.5 | A |
| 05/02/2020 | D | 7.090 | 15 | A |
| 05/02/2020 | G | 7.119 | 20 | A |
| 26/02/2020 | C | 6.540 | 10 | A |
| 02/03/2020 | G | 7.119 | 28 | A |
| 26/02/2020 | G | 7.119 | 28 | A |
| 02/03/2020 | C | 6.540 | 10 | A |
| 02/03/2020 | E | 6.780 | 30 | A |
| 02/03/2020 | BCD | 6.097 | 5.5 | A |
| 02/03/2020 | ABC | 6.016 | 14 | A |
| 02/03/2020 | F | 5.905 | 12 | A |
| 02/03/2020 | D | 7.090 | 15 | A |
| 01/04/2020 | ABC | 6.016 | 14 | A |
| 01/04/2020 | C | 6.540 | 10 | A |
| 01/04/2020 | E | 6.780 | 30 | A |
| 01/04/2020 | F | 5.905 | 12 | A |
| 01/04/2020 | BCD | 5.391 | 5.5 | A |
| 01/04/2020 | D | 7.090 | 15 | A |
| 01/04/2020 | G | 7.119 | 31 | A |
| 06/04/2020 | ABC | 6.016 | 14 | A |
| 06/04/2020 | C | 6.540 | 10 | A |
| 09/04/2020 | C | 6.540 | 10 | A |
| 09/04/2020 | E | 6.780 | 30 | A |
| 09/04/2020 | F | 5.905 | 12 | A |
| 09/04/2020 | BCD | 5.391 | 5.5 | A |
| 09/04/2020 | D | 7.090 | 15 | A |
| 09/04/2020 | G | 7.119 | 20 | A |
| 09/04/2020 | ABC | 6.016 | 23 | A |
| 21/04/2020 | C | 6.540 | 10 | A |
| 03/05/2020 | ABC | 5.618 | 23 | B |
| 03/05/2020 | BCD | 5.391 | 5.5 | B |
| 03/05/2020 | C | 5.79 | 10 | B |
| 03/05/2020 | D | 7.090 | 15 | B |
| 03/05/2020 | G | 7.119 | 25 | B |
| 03/05/2020 | E | 6.78 | 30 | B |
| 03/05/2020 | F | 5.905 | 12 | B |
| 03/06/2020 | ABC | 5.618 | 23 | B |
| 03/06/2020 | BCD | 5.391 | 5.5 | B |
| 03/06/2020 | C | 5.79 | 10 | B |
| 03/06/2020 | D | 6.24 | 15 | B |
| 03/06/2020 | G | 7.119 | 25 | B |
| 03/06/2020 | E | 6.78 | 30 | B |
| 03/06/2020 | F | 5.905 | 12 | B |
| 08/06/2020 | ABC | 5.618 | 23 | B |
| 08/06/2020 | BCD | 5.391 | 5.5 | B |
| 08/06/2020 | C | 5.79 | 10 | B |
| 08/06/2020 | D | 6.24 | 15 | B |
| 08/06/2020 | G | 7.119 | 25 | B |
| 08/06/2020 | E | 6.78 | 30 | B |
| 08/06/2020 | F | 5.905 | 12 | B |
| 01/07/2020 | ABC | 5.618 | 26 | B |
| 01/07/2020 | BCD | 5.391 | 5.5 | B |
| 01/07/2020 | C | 5.79 | 10 | B |
| 01/07/2020 | D | 6.24 | 15 | B |
| 01/07/2020 | G | 7.119 | 25 | B |
| 01/07/2020 | E | 6.78 | 30 | B |
| 01/07/2020 | F | 5.905 | 12 | B |
Any help would be appreciated.
Thanks,
Supriya
5 Replies
- lbendlin
Super User
maybe you can create two What-If parameters and switch between them based on the slicer selection?
- AnonymousNot applicable
Hi lbendlin ,
Thank you for reply. Actually the business need is to have one whatif parameter so that it's easier for the users who'll use the dashboard. But if in case I have 2 whatif parameters, how will I be able to switch based on the category. I am a bit confused how will it work. It would be great if you could suggest.
Thank you.
- v-juanli-msft
Community Support
Hi Anonymous
I can create a parameter table which shows different range based on different category.
Parameter = UNION ( ADDCOLUMNS ( GENERATESERIES ( 500, 9000, 100 ), "category", "B" ), ADDCOLUMNS ( GENERATESERIES ( 2000, 20000, 1000 ), "category", "A" ) )measure
selectedvalue = SWITCH ( SELECTEDVALUE ( Parameter[category] ), "A", SELECTEDVALUE ( 'Parameter'[Parameter], 8000 ), "B", SELECTEDVALUE ( 'Parameter'[Parameter], 4000 ) )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hi v-juanli-msft,
Thank you for your reply. I tried replicating the solution but I guess it's not fully working. Initially, it is working fine as if I select A the value is changing to 4000 and if I select B value changes to 8000. But the slider parameter is not working correctly. I want that if B is selected the parameter slider should only have the range of category B(500-9000) and if I select A the parameter slide should only have the range of A(2000-20000). Currently, it's showing all the range(A+B) and because of this, we are not able to slice it correctly.
Initially-
Sample issue(not able to see A as this value is not in A, ideally based on the category selection the parameter slider range should change)-
- v-juanli-msft
Community Support
Hi Anonymous
do you edit interactions for visuals?
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.