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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
PPars2025
Helper I
Helper I

Bar Chart Conditional Formatting

I'm using the Stacked Bar Chart to display the grading of my field audits and want to apply color conditional formating but I am needing a measure.  I've tried the below DAX but it won't reference the correct data of "Score" within the 2026 New Detail Table.  I've changed the [Avg Score] to just [Score] but that is not working and the error I receive is, "The value for 'Score' cannot be determined. Either the column doesn't exist, or there is no current row for this column."  I added screenshots below if someone can help me with this measure and visual.

 

Bar Color =
SWITCH(
TRUE(),
[Avg Score] <= 2, "#D32F2F", -- Red (Needs Improvement)
[Avg Score] = 3, "#FBC02D", -- Yellow (Meets Expectations)
"#388E3C" -- Green (Exceeds Expectations)
)

PPars2025_1-1768504320089.png

 

PPars2025_0-1768504255964.png

 

1 ACCEPTED SOLUTION
cengizhanarslan
Super User
Super User

1) Create (or reuse) a measure for the value you’re grading

For a bar chart that’s using “Average of Score”, define it explicitly:

Avg Score =
AVERAGE ( '2026 New Detail Table'[Score] )

 

 2) Use that measure in your color measure

Bar Color =
VAR s = [Avg Score]
RETURN
SWITCH (
    TRUE(),
    s <= 2,      "#D32F2F",          -- red
    s = 3,       "#FBC02D",          -- yellow
                 "#388E3C"             -- green
)

 

3) Apply it to the visual correctly

In the stacked bar chart:

  • Format → Data colors

  • Click fx

  • Format by: Field value

  • Based on field: Bar Color

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

View solution in original post

5 REPLIES 5
v-sshirivolu
Community Support
Community Support

Hi @PPars2025 ,
I would also take a moment to thank @cengizhanarslan
 , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

 

cengizhanarslan
Super User
Super User

1) Create (or reuse) a measure for the value you’re grading

For a bar chart that’s using “Average of Score”, define it explicitly:

Avg Score =
AVERAGE ( '2026 New Detail Table'[Score] )

 

 2) Use that measure in your color measure

Bar Color =
VAR s = [Avg Score]
RETURN
SWITCH (
    TRUE(),
    s <= 2,      "#D32F2F",          -- red
    s = 3,       "#FBC02D",          -- yellow
                 "#388E3C"             -- green
)

 

3) Apply it to the visual correctly

In the stacked bar chart:

  • Format → Data colors

  • Click fx

  • Format by: Field value

  • Based on field: Bar Color

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

Thank you!  Can you explain where to findthe following? I am not seeing data colors within the forman pane options:

  • Format → Data colors

Rufyda
Super User
Super User

Hi @PPars2025 ,
Try to create (or use) a measure that aggregates Score, then use it for conditional formatting.
Avg Score =
AVERAGE ( '2026 New Detail Table'[Score] )

Use this measure for bar color

Bar Color =
SWITCH (
TRUE(),
[Avg Score] <= 2, "#D32F2F", -- Red (Needs Improvement)
[Avg Score] = 3, "#FBC02D", -- Yellow (Meets Expectations)
"#388E3C" -- Green (Exceeds Expectations)
)

 


If this response was helpful, please accept it as a solution and give kudos to support other community members
Regards,
Rufyda Rahma | MIE 

I am not sure I am following.  Are you saying to use two measures?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.