Colors and legend → By expression, e.g. If(Sum(Sales) < 0, Red(), Green())

Color by expression in Power BI

Qlik colours chart elements with an expression that returns a colour. Power BI does the same with conditional formatting using "Field value": a measure returns a hex code or colour name.

Direct equivalent DAX Reports

Short answer: Write a measure that returns text such as "#C00000", then in the visual's colour setting click fx → Format style Field value → pick the measure. Rules and gradients work without DAX for simple cases.

What it does in Qlik

Qlik's colour expression runs per data point and returns RGB(), ARGB(), a named colour such as Red(), or a hex string.

Qlik example

Qlik expression
If(Sum(Sales) < Sum(Target), RGB(192,0,0),
   If(Sum(Sales) < Sum(Target) * 1.1, RGB(255,192,0), RGB(0,176,80)))

Power BI equivalent

Colour measure

DAX
Sales colour =
SWITCH (
    TRUE (),
    [Sales] < [Target],       "#C00000",
    [Sales] < [Target] * 1.1, "#FFC000",
    "#00B050"
)

Bar chart: Format → Bars → Color → fx. Table: right-click the field in the Values well → Conditional formatting → Background color (or Font color) → Field value.

Gotchas and behaviour differences

  • In Power BI the measure must return a string (hex #RRGGBB, rgb(...) text, or a CSS colour name). There are no RGB() or Red() functions in DAX.
  • Some visuals only allow conditional colours when there is no legend field, and some custom visuals don't support them. Check the visual before redesigning.
  • Qlik's "persistent colours" for dimension values have no direct counterpart. Keep colours stable with a colour column on the dimension table and conditional formatting on it, or set data colours manually.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.