Others

How to Dynamically Change Power BI Chart Colors Based on User Mode

Ayan MasoodAyan Masood Nov 10, 2026 870 views

Question details

The user needs to display a current-temperature chart measure in different colors depending on the selected user mode (e.g., gray for Auto, red/orange for Heat, and blue for Cool).

How to Change Power BI Chart Colors Based on User Mode
Product
Power BI
Device & OS
not provided
Scenario
Designing a Power BI dashboard where visual elements must dynamically change color to reflect the active contextual state or operational mode.
Observed behavior
By default, the chart displays static data colors. The goal is to bind specific hex color codes to user mode states automatically using conditional formatting.
Before you start

Ensure your Power BI dataset contains a column or measure that accurately evaluates the current user mode (such as 'Auto', 'Heat', or 'Cool') before applying conditional formatting.

Solution 1Recommended

Use a DAX Measure and Conditional Formatting

Create a DAX measure that returns specific hex color codes based on the active user mode, and apply it to your visual's data colors via conditional formatting.

By utilizing the SWITCH function in DAX, you can assign exact hex color codes or standard color names to different data states. This measure is then used to control the visual's formatting dynamically.

1
Create the Color Measure

In Power BI Desktop, navigate to the Home ribbon and click 'New Measure'. Enter a DAX formula using the SWITCH function. For example: ColorCode = SWITCH(TRUE(), [UserMode]="cool", "#12239E", [UserMode]="heat", "#FF8C00", [UserMode]="fan", "green", "#808080").

2
Select the Target Visual

Click on the chart on your report canvas where you want to apply the dynamic color coding.

3
Access Conditional Formatting

Open the Format pane (paintbrush icon), expand the 'Data colors' or 'Columns/Bars' section, and click the 'fx' (Conditional formatting) button next to the default color.

4
Apply the Field Value

In the conditional formatting dialog, change the 'Format style' dropdown to 'Field value'. Under 'What field should we base this on?', select the new 'ColorCode' measure you created, and click OK.

Use a DAX Measure and Conditional Formatting
Shaded Area Limitation: Some built-in Power BI visuals, particularly those with shaded areas like Area Charts, do not natively support conditional formatting for data colors. If the 'fx' button is missing, consider using a standard column chart or exploring the AppSource marketplace for a custom visual.
Free Microsoft Office alternative

Looking for a Lightweight Tool for Everyday Data Visualization?

While Power BI excels at complex DAX logic and large-scale BI reporting, WPS Office provides an incredibly fast and free alternative for everyday data analysis and charting. Perfect for users who need to visualize data quickly without a steep learning curve.

  1. 1. Open WPS Spreadsheet: Launch WPS Office and open your dataset in WPS Spreadsheet.
  2. 2. Insert a Chart: Highlight your data range, navigate to the Insert tab, and select your preferred chart type.
  3. 3. Customize Colors: Click on the chart to reveal Chart Tools, where you can instantly change chart colors and styles using the intuitive formatting pane.
Easily create bar, line, and pie charts with built-in color customization without writing code.Fully compatible with Microsoft Excel formats (.xlsx, .xls) for seamless data transition.Free, lightweight suite covering Writer, Presentation, and Spreadsheets in one tabbed window.Familiar, user-friendly interface for immediate productivity and report generation.
microsoft office alternative - wps office

Frequently Asked Questions

Why is the 'fx' conditional formatting button missing in my visual?

Not all visuals in Power BI support conditional formatting for data colors natively. Built-in line charts, scatter charts, and area charts typically restrict this feature. You will need to switch your visual to a column, bar, or table matrix, or download a supported custom visual.

Can I use color names instead of Hex codes in my DAX measure?

Yes, Power BI's conditional formatting recognizes standard HTML color names like "Red", "Blue", or "Green" written inside the DAX strings. However, using Hex codes (e.g., "#FF8C00") gives you precise control over the exact shade displayed on the dashboard.

How do I conditionally format the background of a visual based on the same user mode?

You can reuse the same DAX color measure. Select the visual, go to the Format pane, expand 'Background' or 'Effects', click the 'fx' button next to the background color picker, and select your measure under the 'Field value' formatting style.