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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sbsgsaw1
Frequent Visitor

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. 

sbsgsaw1_0-1630065000361.png

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

 

1 ACCEPTED SOLUTION

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.

View solution in original post

3 REPLIES 3
sbsgsaw1
Frequent Visitor

Hi, Thanks a million for your help, in your example is table or table 2 the disconected table?

 

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.

lbendlin
Super User
Super 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

lbendlin_1-1630283242786.png

 

Which gives this result

 

 

lbendlin_0-1630283117968.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors