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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Kavya123
Helper III
Helper III

Conditional Color 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 chart=

VAR _SELECTCompanyID =
CALCULATE( SELECTEDVALUE(Company_DataIsland[POrgID] ), REMOVEFILTERS(Company_Info[Sector] ))-- same as REMOVEFILTERS ( 'Product'[Color] )

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 values in the bar should change.  Color condition is based on company selection. company name and  sector  fields are not linked.

 

Please let me know.

2 REPLIES 2
Kavya123
Helper III
Helper III

Hi,

Thanks for the response. Please find the attached screenshots.

Below is the conditional color measure we are using. If we select the filter sector the color should not change. It should be "#dc6900".

In second screenshot after selecting sector field color is changing to "#FFB500" but it should be #dc6900. (Only company filter selection is required)

Color Measure =

VAR _SELECTCompanyID =
CALCULATE( SELECTEDVALUE(Company_DataIsland[POrgID] ), all(Sector[Sector] ))-- same as REMOVEFILTERS ( 'Product'[Color] )

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

Screenshot 2021-10-27 172338.jpg

Capture.PNG

 

Note: Company_DataIsland[POrgID] ) and Sector[Sector]  filelds are coming from different table both are not linked. 
AnswerHistory_Benchmarking and sector tables are linked.

Anonymous
Not applicable

Hi @Kavya123 

Your data model is complex, I need to know more details about your data model. Please share a sample with us and show me the result you want by screenshot. This will make it easier for us to solve your problem.

 

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.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.