Forum Discussion
Who Can do This ?
- Anonymous1 year ago
Thanks for the reply from DataNinja777 , please allow me to provide another insight:
Hi, mianjalil239
Thanks for reaching out to the Microsoft fabric community forum.Regarding the issue you raised, my solution is as follows:
Your initial approach is correct. Based on my testing, Conditional Formatting is available in the y-axis parameter of the Clustered Column Chart visual object only when there is a single field.
Therefore, you simply need to add an additional condition to your Actual Color Measure:1.Firstly, my test data is as follows:
2.Secondly, I have modified your Actual Color Measure to:
Actual Color Measure = IF ( SELECTEDVALUE ( 'KPI'[KPI] ) = "Actual", IF ( [MTD Budget Actual] > [MTD Budget Target], "#FF0000", "#00FF00" ) )3.Next, adjust the custom visual object settings:
4.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi mianjalil239 ,
To apply conditional formatting to only the Actual column in a Clustered Column Chart in Power BI, you need to avoid using a combined measure like Budget MTD for conditional formatting. Instead, separate the Actual and Target values into distinct measures. This allows you to target the Actual series specifically for conditional formatting without affecting the Target column.
First, create separate measures for the Actual and Target values:
Actual MTD = [MTD Budget Actual]
Target MTD = [MTD Budget Target]
Next, create a conditional formatting measure that returns a color based on whether the Actual value exceeds the Target. This measure should output a hex color code to be used in the chart's formatting:
Actual Color Measure =
SWITCH(
TRUE(),
[MTD Budget Actual] > [MTD Budget Target], "#FF0000", // Red for Actual > Target
"#00FF00" // Green for Actual <= Target
)
To apply this conditional formatting to the Actual series, select your Clustered Column Chart in the Visualizations pane. Click the dropdown arrow next to the Actual MTD series in the Values field. Select Data colors, then click the fx (Conditional formatting) icon. In the conditional formatting window, choose Field value as the formatting option and select the Actual Color Measure. Click OK to apply the formatting.
The issue you experienced occurs because applying conditional formatting to a combined measure like Budget MTD affects all series in the chart. By separating the measures and applying the conditional formatting to only the Actual series, you ensure that only the Actual column is colored based on the condition.
If you want to add more granular control, such as using yellow for values close to the target, you can adjust the Actual Color Measure to include additional conditions:
Actual Color Measure =
SWITCH(
TRUE(),
[MTD Budget Actual] > [MTD Budget Target], "#FF0000", // Red for over Target
[MTD Budget Actual] >= ([MTD Budget Target] * 0.9), "#FFFF00", // Yellow for close to Target
"#00FF00" // Green for on or under Target
)
With this setup, the Actual column will turn red if the value exceeds the Target, yellow if it is close to the Target, and green otherwise. The Target column will remain unaffected by the conditional formatting.
Best regards,