Forum Discussion

Kavya123's avatar
Kavya123
Helper III
5 years ago
Solved

Conditional color coding in Bar chart

Hi Everyone, I need to apply condition in bar chart for color coding.  I need output like below screenshot.  ID 1 is having four desc values. The Company ID 100 is associated with desc value 'AAA' ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Kavya123 

    This issue should be caused by Max function in color measure, it will always catch the max Company ID in same Desc. So when you have 100 and 200 in AAA(Desc) in 1(ID), only click 200 will show red. Try values function to get Company ID in Data Table. The new measure is as below.

    Color Measure 1 = 
    VAR _SELECTCompanyID = SELECTEDVALUE('Company ID'[Company ID])
    VAR _VALUES= VALUES('New Table'[Company ID])
    RETURN
    IF(_SELECTCompanyID IN _VALUES,"Red","Yellow")

    Result is as below.

    Best Regards,
    Rico Zhou

     

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