Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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: