Forum Discussion

dexter's avatar
dexter
Icon for Helper II rankHelper II
7 years ago

change the legend labels dynamically based on the value selected in the slicer.

I have the below table.

ID	   Pname     DeliveredDate	   Level  Model 
100	   Mobile    9/22/2018      	    A1	  2018 
109	   PC	     9/23/2018	            A1	  2018 
188	   Mobile    7/11/2018	            A2	  2018 
190	   Laptop     8/11/2018    	    A2	  2016 
200	   TV	      4/18/2018	            A3	  2016 
333	   PC	      4/24/2018	            A1	  2017 
377	  Laptop      4/20/2018	            A2	  2018 
399	  Mobile      4/18/2018              A3	  2017 
400	  Mobile      9/19/2018	            A3	  2016 
403	  Laptop      4/22/2018	            A1	  2017 
404	  Laptop      7/17/2018       	    A3	  2018 
405	  Laptop      7/19/2018	            A3	  2017 
406	  TV	      7/11/2018	            A1	  2017 
407	  TV   	      9/21/2018	            A1	  2017 

I am displaying count of level A1,A2(Created using measures) using stacked column chart.
I have a slicer which shows the Model, based on the selection of the model the chart is changing..
Below are the measures created to count A1, A2.
A1 Count =
CALCULATE(
COUNTAX(
FILTER ( 'ProdData', 'ProdData'[Level] = "A1"),
'ProdData'[Level]
))

A2 Count =
CALCULATE(
COUNTAX(
FILTER ( 'ProdData', 'ProdData'[Level] = "A2"),
'ProdData'[Level]
))

The chart is as shown in the below picture.


When user selects the Model 2016 from slicer, i want to dynamically change the legends shown on the chart.
currently the chart is showing A1 count and A2 Count as legend titles/labels, i want to change the legend labels dynamically based on the value selected in the slicer.

When 2016 is selected from slicer - i want to show the legend labels on the chart as Product(A1-16) and Product(A2-17) in place of A1 Count and A2 Count..
When 2017 is selected from slicer - I want to show the legend titles on the chart as Product(A1-17) and Product(A2-18)
When 2018 is selected from slicer - I want to show the legend titles on the chart as Product(A1-18) and Product(A2-19)

Any inputs on how to change the legend titles dynamically based on the user selection on the slicer?Thanks.

5 Replies

  • You can't change the legend but we could add a dynamic card on top of the chart if you're open to it

    • dexter's avatar
      dexter
      Icon for Helper II rankHelper II

      LivioLanzo - On the dynamic card,can we show the small circle's with colors as shown in the legend followed by the dynamic label? If it can be shown then i can hide the legend on the chart and users can see the card visualzation instead labels.Need help.

      • LivioLanzo's avatar
        LivioLanzo
        Icon for Solution Sage rankSolution Sage

        Hi Dexter, you cannot show the small circle with colors if that is what you are after