Forum Discussion

smohapatra's avatar
smohapatra
Regular Visitor
9 years ago
Solved

How to show different field value based on Slicer select/deselect

Hi ,   I have a slicer say organization name and I have a history trending visual which has a KPI value for last 6 months. This KPI value is from a table where I am calculating the same based on di...
  • MFelix's avatar
    9 years ago

    Hi smohapatra,

     

    I believe that you can achieve that with the SWITCH formula, since you have different measures for organizational and Individual you can use something like this:

     

    KPI_Value =SWITCH(
                                      TRUE();
                                          CALCULATE(
                                                DISTINCTCOUNT(Table1[Company]); 
                                                ALLSELECTED(Table1[Company]))>1;
                                     [OVERALL_MEASURE];
                                     [INDIVIDUAL_MEASURE])

    I assume that you only want to have one value in the slicer that's why I look at greater than 1 to return the Overall, if you need to have the single value for more than one choice you can use this one:

     

    KPI_Value =SWITCH(
                                      TRUE();
                                          CALCULATE(
                                                DISTINCTCOUNT(Table1[Company]); 
                                                ALLSELECTED(Table1[Company]))=
                                                CALCULATE(
                                                DISTINCTCOUNT(Table1[Company]); 
                                                ALL(Table1[Company]));
                                     [OVERALL_MEASURE];
                                     [INDIVIDUAL_MEASURE])

     

    I don't know if  you have a separate table for the slicer or it's on the Dataset as one table but the distinctcount must be done in the table were you have the slicer allocated.

     

    This formula was done only with a simple table with companies and count of companies no other information but should work with different setups also.

     

    Regards,

    MFelix