Forum Discussion
Highlight a specific bar based on slicer selection
Hi
I implemented a suggestion found here in the forums. I must be doing something wrong. It's not working.
I have a chart that lists some values for each country in a region. In the example, it's Latin America. I want to highlight Brazil by coloring it red, while keeping the other values grey.
Based on the example I've seen, I did the following:
1) Created a separate and disconnected table ("tableCountry") of just the countries that form the y-axis of the chart ("Lists[Country]") ;
2) Created a slicer with the countries from "tableCountry"
3) Created a measure as follows:
Just checked out your sample file. The problem is that the country names in the 'tableCountry' table don't match the country names in the 'Lists' table (probably an extra space at the end or something)
I Just created a new table to check it out using DISTINCT and you get this:
9 Replies
- amitchandakSuper User
paulmorgan , This seems correct to me
Try this. Just sure country names are matching
colorFocus = IF( MAX ( Lists[Country] ) in allselected(tableCountry[Country] ),"Red","Grey")
I am assuming List is name of column, that is used on x-axis
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
- paulmorganHelper II
Thanks very much for your suggestion. Unfortunately, it didn't work for me. I created a sample file, but I guess I don't "rank" being able to upload pbix files, and my company doesn't allow for people outside the company to access OneDrive files, and I don't have a Dropbox account. I tried uploading to Google Drive, but it gives me basically a "file structure" when I click on it instead of an actual pbix file.
If you have any other suggestions on how to share the file, let me know. Regardless, I do appreciate your willingness to help out!
- PaulDBrownCommunity Champion
Google Drive is fine (even though you "see" a file structure, if you download you get the PBIX file). Alternatively, try a file transfer service such as:
Btw, did you check out the suggested thread ?
- PaulDBrownCommunity Champion
- BeinexpowerbiAdvocate I
hi @powerbi-learner 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/