Forum Discussion
Conditionally colour Column based on Slicer Selection
Hi
i may be coming at this all wrong but here goes,
i have a dashboard of staff performance where the visuals are set by the selection of a name, in most cases this means that visuals only contain data relevent to that person, but i want to show their performance amongst their peers, so for this visual i made it so the Name Slicer has no effect on those values. this works as i want it to, now the icing on the cake would be to highlight the selected Agents column in a contrasting colour. In excel i have done this by creating 2 series where one contains the values for the selected agent and blanks on the rows that are not the selected agent and the other vis versa then plot them on a stacked column chart and bingo.
There is probably a better way in PBI but i am struggling to escape the filter context in the right way i think. i can make it work with a simple measure like if (agent name = "Beth","Green","Blue") and use that in the default colour on data colours, but when i try to use a dynamic value from the Slicer it fails.
any help greatfully recieved.
Thanks
Table2 is the disconnected table that feeds the slicer. You can create it in Power Query as a duplicate of Table, then choose the User column and remove duplicates.
9 Replies
- lbendlinSuper User
sbsgsaw1 use a disconnected table to feed the user slicer. Then create a measure that checks which user is selected and apply the color accordingly
Measure = if(SELECTEDVALUE('Table'[User])=SELECTEDVALUE('Table (2)'[User]),"Red","Blue")Then use conditional formatting on the data colors for the visual
Which gives this result
- sbsgsaw1Frequent Visitor
Hi, Thanks a million for your help, in your example is table or table 2 the disconected table?
- lbendlinSuper User
Table2 is the disconnected table that feeds the slicer. You can create it in Power Query as a duplicate of Table, then choose the User column and remove duplicates.
- butterfly_fly25New Member
Hello,
It's been almost 4 years since your answer but it just woked for me so it is amazing.
I was wondering if there's any way to have this work but for multiple selections, like if you were to choose both A and B then both columns would become red and the other one would remain blue.
Every time that I select multiple options in the slicer it takes the FALSE.
Thanks