DAX code
Sales Color (Conditional Formatting) =
VAR CurrentSales = [Total Sales]
VAR Target = [Sales Target]
RETURN
IF(CurrentSales >= Target, "#2E7D32", "#C62828")
Returns a hex color string driven by whether sales are on or off target, for use in Power BI's conditional formatting.
Type your table and column names once. Every measure below updates.
Sales Color (Conditional Formatting) =
VAR CurrentSales = [Total Sales]
VAR Target = [Sales Target]
RETURN
IF(CurrentSales >= Target, "#2E7D32", "#C62828")
Replace [Sales Target] with your own target measure, or a fixed number. Apply this measure under a visual's Conditional formatting > Font color / Background color, set to "Field value".
Browse all 175 measures in the Power BI DAX Measures Library, or search the library for something similar to Sales Color (Conditional Formatting).