Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Highlight column with filtered name

Hi,

I have a slicer on the left with the names of salespeople, and, on the right, a bar chart with total sales per person. I want to select a name from the left and see their bar in another colour (I disabled the filter from that slicer to the bar chart so that every salesperson is shown. 

  • Example of solution:

     

     

     

     

     

     

     

    How to do that?

    1. Create dim_person table

    dim_person = GROUPBY(Sales,Sales[Person])
     
    2. Do not connect it to the oryginal one.
     
    3. In the table change person field to dim_person[Person]

     

    4. Create a measure:

    Revenue Value = CALCULATE(SUM(Sales[Revenue]),Sales[Person] in VALUES(dim_person[Person]))
     
    5. Another measure:
    SelectedPerson = IF(ISFILTERED(Sales[Person]),MAXX(FILTER(dim_person,dim_person[Person] in VALUES(Sales[Person])),1))
     
    Configuration of a table:

     

    Configuration of a slicer:

     

    At this point you're suppose to have a table that is not affected by a slicer and always show values.

     

    Conditional formating

    Click on the table and go to format pane > visual > bars > colors and click on fx

    Change format style to Rules on the field SelectedPerson and make a condition:

    if value = 1 number then selected color.

    Click OK and that's it 🙂

5 Replies

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

    Example of solution:

     

     

     

     

     

     

     

    How to do that?

    1. Create dim_person table

    dim_person = GROUPBY(Sales,Sales[Person])
     
    2. Do not connect it to the oryginal one.
     
    3. In the table change person field to dim_person[Person]

     

    4. Create a measure:

    Revenue Value = CALCULATE(SUM(Sales[Revenue]),Sales[Person] in VALUES(dim_person[Person]))
     
    5. Another measure:
    SelectedPerson = IF(ISFILTERED(Sales[Person]),MAXX(FILTER(dim_person,dim_person[Person] in VALUES(Sales[Person])),1))
     
    Configuration of a table:

     

    Configuration of a slicer:

     

    At this point you're suppose to have a table that is not affected by a slicer and always show values.

     

    Conditional formating

    Click on the table and go to format pane > visual > bars > colors and click on fx

    Change format style to Rules on the field SelectedPerson and make a condition:

    if value = 1 number then selected color.

    Click OK and that's it 🙂
  • bolfri's avatar
    bolfri
    Icon for Solution Sage rankSolution Sage

    Is you disabled filtering from that slicer it can't be done, but you can simply create two measures:

    Total sales without selected salesperson and total sales with selected salesperson (if selected).

     

    Then on the bar chart change the color of the Total sales and Total sales per selected. You will get the effect that you want. 

     

    If you will share pbix file with sample data I can help you with that.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, how can I share the file? 

      or you can write the measures here if you want, I am not sure what you mean by:

      Total sales without selected salesperson and total sales with selected salesperson (if selected).