Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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- 

Cvalue = GENERATESERIES(2000, 20000, 1000)
Cvalue = SELECTEDVALUE('Cvalue'[Cvalue], 8000)
 

 

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)

 

So based on slicer input from categories, the what-if parameter value should change and their respective values should be used in the Dax calculation.
I am attaching sample data as well.
 
DateComNumRC%Categories
03/01/2020ABC6.01614A
03/01/2020BCD6.0975.5A
03/01/2020C6.54010A
03/01/2020D7.09015A
03/01/2020E6.78030A
03/01/2020F5.90516A
03/01/2020G7.11930A
05/02/2020C6.54010A
05/02/2020E6.78030A
05/02/2020F5.90516A
05/02/2020ABC6.01614A
05/02/2020BCD6.0975.5A
05/02/2020D7.09015A
05/02/2020G7.11920A
26/02/2020C6.54010A
02/03/2020G7.11928A
26/02/2020G7.11928A
02/03/2020C6.54010A
02/03/2020E6.78030A
02/03/2020BCD6.0975.5A
02/03/2020ABC6.01614A
02/03/2020F5.90512A
02/03/2020D7.09015A
01/04/2020ABC6.01614A
01/04/2020C6.54010A
01/04/2020E6.78030A
01/04/2020F5.90512A
01/04/2020BCD5.3915.5A
01/04/2020D7.09015A
01/04/2020G7.11931A
06/04/2020ABC6.01614A
06/04/2020C6.54010A
09/04/2020C6.54010A
09/04/2020E6.78030A
09/04/2020F5.90512A
09/04/2020BCD5.3915.5A
09/04/2020D7.09015A
09/04/2020G7.11920A
09/04/2020ABC6.01623A
21/04/2020C6.54010A
03/05/2020ABC5.61823B
03/05/2020BCD5.3915.5B
03/05/2020C5.7910B
03/05/2020D7.09015B
03/05/2020G7.11925B
03/05/2020E6.7830B
03/05/2020F5.90512B
03/06/2020ABC5.61823B
03/06/2020BCD5.3915.5B
03/06/2020C5.7910B
03/06/2020D6.2415B
03/06/2020G7.11925B
03/06/2020E6.7830B
03/06/2020F5.90512B
08/06/2020ABC5.61823B
08/06/2020BCD5.3915.5B
08/06/2020C5.7910B
08/06/2020D6.2415B
08/06/2020G7.11925B
08/06/2020E6.7830B
08/06/2020F5.90512B
01/07/2020ABC5.61826B
01/07/2020BCD5.3915.5B
01/07/2020C5.7910B
01/07/2020D6.2415B
01/07/2020G7.11925B
01/07/2020E6.7830B
01/07/2020F5.90512B

 

Any help would be appreciated.

 

Thanks,

Supriya

5 Replies

  • maybe you can create two What-If parameters and switch between them based on the slicer selection?

    • Anonymous's avatar
      Anonymous
      Not 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's avatar
    v-juanli-msft
    Icon for Community Support rankCommunity 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.

    • Anonymous's avatar
      Anonymous
      Not 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's avatar
        v-juanli-msft
        Icon for Community Support rankCommunity 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.