Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Kavya123
Helper III
Helper III

Color condition in Bar chart

Hi All,

I have a field company name from one table. And different field called Sector from different table.

This is the measure we are using in bar chart which is linked to Sector field.
Measure 4 =
CALCULATE(DISTINCTCOUNT( AnswerHistory_Benchmarking[POrganization]) , FILTER(AnswerHistory_Benchmarking, AnswerHistory_Benchmarking[POrganization] <> 6377
)
, FILTER(RR_Datapoint,RR_Datapoint[RR_ID]=1) )
If I select filter Sector values are changing accordingly.

 

 

And this is the conditional Color Measure we are using in bar cahrt =

VAR _SELECTCompanyID =
CALCULATE( SELECTEDVALUE(Company_DataIsland[POrgID] ))
VAR _VALUES= VALUES(AnswerHistory_Benchmarking[POrganization] )
RETURN
IF ( _SELECTCompanyID IN _VALUES ,"#dc6900","#FFB500 ")


Now If I select Sector filter bar colors should not change only measure value should change.  Color should reflect only based on company selection. Please let me know.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Kavya123,

I think you need to remove the relationship from the slicer source table to the fact table first, then you can directly use measure expression to extract the selection and use in if statement for color formating.

Color Measure =
VAR selected =
    VALUES ( Company_DataIsland[POrgID] )
VAR _current =
    SELECTEDVALUE ( AnswerHistory_Benchmarking[POrganization] )
RETURN
    IF ( _current IN selected, "#dc6900", "#FFB500 " )

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Kavya123,

I think you need to remove the relationship from the slicer source table to the fact table first, then you can directly use measure expression to extract the selection and use in if statement for color formating.

Color Measure =
VAR selected =
    VALUES ( Company_DataIsland[POrgID] )
VAR _current =
    SELECTEDVALUE ( AnswerHistory_Benchmarking[POrganization] )
RETURN
    IF ( _current IN selected, "#dc6900", "#FFB500 " )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors