Forum Discussion
Conditional formatting not working
- 1 year ago
Hi mogugu_84
I'm thinking it's because you used text in your condition instead of a number which is how Rules are being evaluated. "1" is not 1. Also, please try to use this measure. Select Field Value from the conditional formatting options and use this measure.
3M G% Conditional Formatting = VAR _total = CALCULATE ( [3M G%], ALLSELECTED () ) -- Calculate the total 3M G% while considering all selected values in the filter context. -- This removes any specific row-level filters but still respects slicer selections. RETURN IF ( [3M G%] > _total, "#f6b53d", "#e85e76" ) -- Compare the current 3M G% value against the total. -- If the current value is greater than the total, return the color code "#f6b53d" -- Otherwise, return "#e85e76"
Hi mogugu_84,
When conditional formatting doesn’t change as expected, it’s often due to how the formatting rule is set up versus how the measure is being used. You can modify your DAX as
Color Check Hex =
IF(
[3M G% Fyc] > [3M G% Fyc National],
"#FFFF00", // Yellow
"#FF0000" // Red
)
Now, In your matrix, go to the column settings for “3M G%” and set the conditional formatting to “Format by field value.” Then, select your new color measure (e.g., Color Check Hex) as the field to base formatting on.
Ensure Proper Context:
Make sure that the measures ([3M G% Fyc] and [3M G% Fyc National]) are calculating correctly within the visual’s row context. For instance, verify that [3M G% Fyc National] (which uses ALL) is indeed returning the total value you expect across all rows.
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!