Custom Colors for Dynamic Selection 

Problem:

Create a slicer with a different color for each option selected 

Here in this example, the necessity was selecting the measures to be shown in a chart but reflecting the line chart color of the measure in the slicer selection 

Solution:

1) First of all, we have to create a table with the values to select

ChartDirectCosts =
    VAR LogicTest = COUNTROWS(DISTINCT(
        FILTER(
            ALLSELECTED(ChartMeasures[Measure]),
            ChartMeasures[Measure] = "Direct Costs"
        )
    ))
RETURN
IF(
    LogicTest,
    [COGS],
    BLANK()
)

2) Create specific measures for each selected value

3) Set all the measures created in the chart

4) Now we have to place one chiclet slicer per measure to be shown, set on it the category value to the column created in step 1, set a filter with just one of the values of our measures, and set the specific color for this selection. Then repeat the process for the remaining buttons

Category:

Filter:

Color:

Ta-dah:

Previous
Previous

Sort Rows in Matrix Visual