Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
smohapatra
Regular Visitor

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 different organization as group by and also I am calculating the KPI value for overall (note the calcuations for overall and individual organization is slightly different in nature) . Now I want my history trending visual to display overall value of the KPI when there is no selection in organization slicer then the value should be correspoding to overall and when there is any individual organization slicer is selected then it should display the value for corresponding L3.

 

Second part is already done as it is already calculated in table, But the first part is I am anot sure how to achieve ? Please let me know if anybody has any idea ?

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

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

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

4 REPLIES 4
v-huizhn-msft
Employee
Employee

Hi @smohapatra,

After review, please try to create measure based on @MFelix posted, and check if it works fine.

If you still have not resolved your issue, please post some sample date for further analysis, so that we can post solution which is close to your requirement.

Thanks,
Angelia

Thanks Mfelix,

For your  inputs. I am trying the solution provided by MFelix. I will try and let you know.

 

Regards,

Shakti

@MFelix, Thanks the solution worked. I used a IF condition and as I was having more than one organization so the conditions was something like as below :

 

KPI = IF(DISTINCTCOUNT(Table[Org])>number of Org,Overall Measure,Org Measure)

MFelix
Super User
Super User

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

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.