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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
gdxy
Helper I
Helper I

Bar display according to slicer

Hi,

 

Currently, I am working on displaying data with a bar chart and a slicer, I would like to have the bar highlighted when being selected instead of just showing the selected item, how can I have the effect like fig 1 instead of fig 2, thx!

Fig1: 

gdxy_0-1665202009851.png

Fig2:

gdxy_1-1665202082050.png

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @gdxy ,

 

if the axis of the bar chart and the content of the slicer are coming from the same table this will not work.

Create a model that looks like this:

image.png


The table slicer is used to provide the content for the slicer.

 

Create a measure like this:

 

vizAid HighlightColumn = 
var SelectedSlicerItems = VALUES( 'Slicer'[item] )
return
IF(
    SELECTEDVALUE( 'Dimension'[item] ) in SelectedSlicerItems
    , "red"
    , "blue"
)

 

Use the measure to add conditional formatting to the columns:

Use the table Dimension to populate the axis, then you can create something like below: 

image.png

 

Hopefully, this provides what you are looking for.

 

Regards,
Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

5 REPLIES 5
TomMartens
Super User
Super User

Hey @gdxy ,

 

if the axis of the bar chart and the content of the slicer are coming from the same table this will not work.

Create a model that looks like this:

image.png


The table slicer is used to provide the content for the slicer.

 

Create a measure like this:

 

vizAid HighlightColumn = 
var SelectedSlicerItems = VALUES( 'Slicer'[item] )
return
IF(
    SELECTEDVALUE( 'Dimension'[item] ) in SelectedSlicerItems
    , "red"
    , "blue"
)

 

Use the measure to add conditional formatting to the columns:

Use the table Dimension to populate the axis, then you can create something like below: 

image.png

 

Hopefully, this provides what you are looking for.

 

Regards,
Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
VijayP
Super User
Super User

@gdxy 

In normal course of action it is not possible. 

workaround , Create a slicer and table and chart

remove the interaction between chart and Slicer

create interaction between chart and table as highligh

select slicer which shows single value in table and select the value in table which creates the effect required by you!

But that I donot think that is going to be an automated !




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


lukiz84
Memorable Member
Memorable Member

I can't imagine any way that would be possible... sorry

Avantika-Thakur
Solution Supplier
Solution Supplier

Hi @gdxy ,

1) You can remove the interaction of the slicer with the bar chart so that it doesn't filter out the selected element in bar graph.

2) Then  create a measure for highlighting colour of the selected bar - 
Measure = IF(Level = SelectedValue(Level), "Dark Colour hex code for highlighting","Light Colour hex code for highlighting")
3) Add this colour returning measure to the "Fx" option of the bar chart setting of Bar colours.

 

Hope this helps!

Please accept the solution if this answers your query.

 

Thanks,

Avantika

And what would the Level in IF(Level = ...) be in a measure? That's not possible.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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