Forum Discussion

SuryaDave's avatar
SuryaDave
Helper I
1 year ago
Solved

Conditional Colouring Bar Chart

Hello Experts,   I am stuck with something that I guess is not too complex but I am not able to figure out.   Basically, I have bar chart where I want to colour bars conditionally.    So,...
  • Ritaf1983's avatar
    1 year ago

    Hi SuryaDave 
    You can use disconected table of organization , and keep the visual interactions.

    + this tablle will be the source for the slicer :

    For the color you can use a DAX with the wanted color HEXA codes ( i used names  of colors just to show the logic) :

    Color =

    if (SELECTEDVALUE(Sheet1[Organisation])= "State Level", "Green",

    IF(SELECTEDVALUE(Sheet1[Organisation]) IN( VALUES(Organization[Organisation])),"Pink", "Grey" ))

    Result :

    The pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

    Conditional Colouring 23 July 2025.pbix22 KB
  • Ritaf1983's avatar
    Ritaf1983
    1 year ago

    Hi SuryaDave 
    You can use the method of "play role relationship".
    Create a inactive relationship without your table and organizations :

    For other visualizations that need to be filtered you can use the "Userelationship" function to make the relationship active .
    Like :

    Filtered_measure = CALCULATE(AVERAGE(Sheet1[Avg Values]),USERELATIONSHIP(Organization[Organisation],Sheet1[Organisation]))
    Result:

    The updated pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

    Conditional Colouring 23 July 2025.pbix23 KB