Forum Discussion

paulmorgan's avatar
paulmorgan
Helper II
5 years ago
Solved

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: 

colorFocus = IF( MAX ( Lists[Country] ) = SELECTEDVALUE( tableCountry[Country] ),"Red","Grey")
4) Create a conditional formatting for the Data Colors in the chart using "Field Value" Based on field: "colorFocus"
 
The bars are all grey. If I select Brazil, it doesn't color that bar Red. 
 
Any guidance would be most appreciated.
 
  • PaulDBrown's avatar
    PaulDBrown
    5 years ago

    paulmorgan 

    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

  • 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.

    • paulmorgan's avatar
      paulmorgan
      Helper 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!

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        paulmorgan 

        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:

        Wetransfer 

        Btw, did you check out the suggested thread ?