Conditional Formatting

Power BI · Data Visualization

Theory

Conditional formatting changes how values look based on the values themselves: background colour, font colour, data bars, icons or web URLs in tables and matrices, and data colours in many charts. You can format by Gradient (colour scale from lowest to highest), by Rules (if value is between X and Y, use this colour), or by Field value, where a measure returns the colour name or hex code to use.

For example, in a table of regions you can set the Total Sales background with rules: at least ₹3,000 green, at least ₹1,000 amber, otherwise red. North (₹3,200) turns green, West (₹2,400) amber and South (₹600) red. The Field value option is the most flexible: a measure using SWITCH can return "#2E7D32" or "#C62828" and the same logic can colour a table, a bar chart and a card consistently.

Why we use it

Colour draws the eye to what needs attention. Readers spot underperforming regions or products instantly instead of scanning every number in a table.

When to use it

Use it to highlight exceptions and thresholds the business cares about. Avoid colouring everything or using red and green alone, which colour-blind readers struggle with; add icons or labels as well.

How it works

  1. Choose a value to highlight
  2. Open Cell elements or chart Colors → fx
  3. Is the logic a fixed threshold? Yes: Use Rules. No: Use a Field value measure or Gradient.
  4. Set colours and test with real values
  5. Exceptions stand out on the page

Syntax

Table/matrix: Format → Cell elements → choose series → Background color / Font color / Data bars / Icons → fx
Format style: Gradient | Rules | Field value
Charts: Format → Bars/Columns → Colors → fx

Example

// Field value approach: a measure returns the colour
Sales Colour = 
SWITCH(
    TRUE(),
    [Total Sales] >= 3000, "#2E7D32",   // green
    [Total Sales] >= 1000, "#F9A825",   // amber
    "#C62828"                           // red
)
// Format → Cell elements → Background color → fx → Format style: Field value → Sales Colour

Key points

Power BI topics

Power BI Introduction

Getting Data

Power Query (Data Transformation)

Data Modeling

DAX (Data Analysis Expressions)

Data Visualization

Dashboards & Reports

Power BI Service

Advanced Features

Projects & Case Studies

Interview & Certification

Advanced DAX & Time Intelligence

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Power BI Dashboards & DAX

Learn data visualization and interactive dashboards step-by-step. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice DAX Online 250 business scenarios on a star schema — write a measure and compare your visual with the expected one. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Power BI  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax / Where to find it
{{ current.syntax }}
Example
{{ current.example }}
What You'll Learn — click to check off
  • {{ pt.mark }} {{ pt.text }}

Share this topic