Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello everyone,
I have a problem with conditional formatting.
I would like to apply custom conditional formatting to a stacked column / bar chart that has different categories on the x-axis. Example:
Please not: the range changes between the two categories.
It is possible to do that in Power Query or in DAX?
Solved! Go to Solution.
Since you can use a measure for conditional formatting you can create whatever arbitrary rules you'd like.
For example, you could write a measure similar to this
Formatting =
VAR _Cat = SELECTEDVALUE ( Table1[Category] )
VAR _Value = [AvgMeasure]
RETURN
SWITCH (
TRUE (),
_Cat = "Category 1" && _Value = 100, 1, // Green
_Cat = "Category 1" && _Value >= 50 && _Value < 100, 2, // Yellow
_Cat = "Category 1", 3, // Red
_Cat = "Category 2" && _Value = 100, 1, // Green
_Cat = "Category 2" && _Value >= 80 && _Value < 100, 2, // Yellow
_Cat = "Category 2", 3, // Red
4
)
and then set up your formatting rules like this:
Since you can use a measure for conditional formatting you can create whatever arbitrary rules you'd like.
For example, you could write a measure similar to this
Formatting =
VAR _Cat = SELECTEDVALUE ( Table1[Category] )
VAR _Value = [AvgMeasure]
RETURN
SWITCH (
TRUE (),
_Cat = "Category 1" && _Value = 100, 1, // Green
_Cat = "Category 1" && _Value >= 50 && _Value < 100, 2, // Yellow
_Cat = "Category 1", 3, // Red
_Cat = "Category 2" && _Value = 100, 1, // Green
_Cat = "Category 2" && _Value >= 80 && _Value < 100, 2, // Yellow
_Cat = "Category 2", 3, // Red
4
)
and then set up your formatting rules like this:
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 16 | |
| 12 | |
| 9 | |
| 6 | |
| 6 |