Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Color bar chart based on value in another table & column

Hello,

 

Is there a way to color a bar chart's bars based on values in another table & column? I have one table which displays fault codes and their occurrences, and another table that relates those fault codes to fault levels. 

 

I have tried conditional formatting and creating DAX measures, but each of those wants me to aggregate the fault level column. which I do not need. Essentially I need conditional formatting along the lines of (in pseudocode):

if fault_level = "0 - No Reaction", color those bars blue, else if fault_level = "1 - Dash Telltale Only", color those bars green, else if fault_level = "2 - Torque Limited to 35%", color those bars yellow, else if fault_level = "3 - Zero Torque", color those bars orange, else if fault_level = "4 - Vehicle Shutdown", color those bars red.

 

For example, if fault 234 has a fault level of zero, I want that bar to be blue. If fault level has a fault level of 3, I want that to be orange.

 

Please see the screenshots below.

 

 

I tried conditional formatting, but the summarization is not needed and it won't let me conditionally format without it.

Any help would be deeply appreciated!

  • Anonymous's avatar
    Anonymous
    2 years ago

    I figured it out, I needed to add a legend with the same column I was conditionally formatting with.

3 Replies

  • christinepayton's avatar
    christinepayton
    Most Valuable Professional

    Does it work with that summarization? Usually as long as the summarization doesn't do something you don't want it to be doing, it's fine to let it do its thing. In this case, if it's getting the first fault level, and you have a rule for each fault level, I'd expect it to work fine assuming your relationship is flowing in the right direction. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      It does not, unfortunately. The bar chart in the attached screenshot in my previous post is the result of the conditional formatting I also screenshotted in the previous post. Initially, the bar chart was a darker blue.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I figured it out, I needed to add a legend with the same column I was conditionally formatting with.