Tiny Tips: Power BI - Conditional Colouring Bar Charts

Welcome to my new series, where we dive into the quick, chic tips for data analytics and visualization that can (hopefully) be implemented faster than you can flag down a black cab in Central London. Think of it as the Pret A Manger of analytics advice—bite-sized, satisfying, and guaranteed to make you feel like the Samantha of your office.

Since Cohort 48 has been deep in Power BI week (I see you all at your desks in the City, juggling KPIs and flat whites), let’s kick things off there. Picture this: the whole class groaning when I casually asked Robbin how to make a bar chart change colour based on a slicer selection. Sorry, team! But in my defence, how could I not chase this idea down? And now, like a good mate sharing the latest finds at Liberty London, I’m passing this little hack on to you.


Step 1: Make the Measures

Under the Home tab in Power BI, you’ll find a button called New Measure. It’s the DAX equivalent of jotting down a cheeky column idea on the Overground—it’s where inspiration turns into reality.

Here’s what you do:

  1. Create measures for "Total Profit" and "Total Sales."
  2. Aggregate them using SUM, because raw data is like Tesco meal deals—not bad, but not dinner-party ready.
You simply type the name of your measure before the "=" then your calculation after.

Step 2: Create a Parameter

Next, head to the Modeling tab and click New Parameter. This is where we pull in our measures, give the parameter a name worthy of an afternoon in Mayfair, and click Create. It’s like assembling your Soho House guest list—curated, intentional, and designed for a smashing time.

Here we dragged our two measures in to create our parameter.

Step 3: Build the Bar Chart

Click on the bar chart visual, drag a categorical column (like Region) to the Y-axis, and the parameter to the X-axis. Voilà! A bar chart that changes based on your slicer selection. But hold on—this chart is analytics’ answer to a roast dinner without Yorkshire puddings.

Y-Axis= Region, X-Axis= Total Profit and Sales Parameter

Step 4: Add Colour

Here’s where we make the magic happen. Two options:

  1. Colour Measure: Write a simple DAX formula that assigns a colour (e.g., teal for profit, orange for sales) based on the parameter value.
We created a new measure using an "IF statement" telling the program how to colour the bars.
Under the format tab, you'll find "bars". Here you'll click the "FX" button under the colour tab, which will bring you to this pop up.
Select Field value, and the new colour based measure.
  1. Rule-Based Colouring: Skip the DAX faff and set rules directly in the Format Visual tab.
Navigate to the same "FX" button under "bars". Instead select rules, our original Total profit and Sales Parameter. Now you simply pick which value you want as which colour.

Either way, your bar chart will now be giving Harrods-window-display energy and actionable insights.

The final product! A bar graph that changes colour based on the selected slicer. TA-DA!

If you fancy giving this a go, download the Sample-Superstore dataset here. Because in data analytics, as in life, it’s not just about the numbers—it’s about how you present them.

And just like that, your bar chart became the talk of the Tube.


Song of the Day:

~S xoxo

Author:
Sandy Wlodarczyk
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab