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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
PVS07
Helper III
Helper III

Highlight selected bar in a column chart

Hi All,

I have got a column chart with 79 geographies and a slicer with the 79 geographies. The column chart is not dependent on the slicer however there are other visualisations in the page that are dependent on the slicer.

 

What I would to achieve is when I select a specific geography in the slicer the bar that corresponds to that selected geography should be highlighted (i.e. a different colour fill). Can someone please let me know if it is possible to achieve. 

 

Please see below the screenshot and also link to the .pbix file for your reference. 

 

https://1drv.ms/u/s!AubIV2PXG9p4gqhykbbmeMfFYlChCw?e=w6UABf 

 

 

Thank you.

Highlight.png

 

 

1 ACCEPTED SOLUTION

@PVS07 , not sure what is wrong. I tried the same stuff on a new page it is working. Check page 2

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

8 REPLIES 8
Beinexpowerbi
Advocate I
Advocate I

hi @PVS07  we have created a solution to this using dax .

 

Please check our latest blog on this :

https://www.beinex.com/blog/dynamic-highlight-bar-chart-with-slicer/

PVS07
Helper III
Helper III

I have found this great solution posted on YouTube today (8 Oct 2020) by Patrick from "Guy in a Cube" channel that shows how to conditionally highlight a bar in a Power BI Report. Check it at https://www.youtube.com/watch?v=L2GnAfpsO2k

amitchandak
Super User
Super User

@PVS07 , in case you are not using legend and only using one measure you will be able to see conditional formatting.

You have created an independent slicer. Not coming from the table or joined to the table

 

create a color meausre like given below and use that in conditional formatting with "Field value" option

if(FIRSTNONBLANK(Table[locality],"true")= selectedvalue(locality[locality],"green","blue")

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @amitchandak,

 

I have followed your instructions and created a new table with only the locality column. I have used this column for the slicer. However after I created a new measure using your formula it did not work. Can you please let me know what am I doing wrong? Thanks a ton for your assistance. 

My formula - 

Colour = IF(FIRSTNONBLANK(Sheet1[Locality],"true") = SELECTEDVALUE(Locality[Locality]),"green","blue")

 

Here is the link for the updated .pbix file - https://1drv.ms/u/s!AubIV2PXG9p4gqhykbbmeMfFYlChCw?e=w6UABf

 

PVS07_1-1598946590995.png

 

 

 

@PVS07 , not sure what is wrong. I tried the same stuff on a new page it is working. Check page 2

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hello

I followed what you did. When I select a modality at the filter level, only one bar is displayed. how to solve this ? Thanks

 

gerardkouadio_0-1661177282852.png

 

 
 

 

 

Hi @amitchandak,

Thanks a lot for the quick response and solution. Greatly appreciated.  

I checked your version on Page 2 and my version with the solution that you provided initially, they both were same but for some reason it wasn't working. I removed the chart and slicer and redid it, Voilà it worked. 

 

You are a champ. Thank you.

Greg_Deckler
Super User
Super User

@PVS07 - Not if it is the same column in the slicer and the column chart. You would need a disconnected table for your slicer. The reason is that if you turned off interactions, the visual has lost all reference to what is selected in the slicer, you basically can't figure it out. With a separate table you can. Now, this would like mean vast changes for your other visuals obviously.

 

But, if you had this disconnected table, you could theoretically do it by using the default color "fx" to determine the color of the column by comparing if the column matched the slicer value.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.