top of page

How to change the colors of your visuals based on the selected measure

Updated: Dec 1, 2022

Have you ever wondered how people do the trick below?

ree

Say no more!


I'm going to share with you all the tricks that you need to do to achieve something like this.


In my example, I created a report where you could switch the measure the charts were showing, and with that, the color of the charts and KPI cards changed to.


The first thing you need to do is create your base measures. In my example my base measures were:

Number of Orders = count(Amazon[Order ID])
Orders Value £ = SUM(Amazon[Amount])

I only used two measures, but you can have more measures if you want to.


The next step is to create a field parameter, that will allow you to switch between the two measures:

ree

My parameter formula looks like this:

Parameter 1 = {
    ("Orders Value £", NAMEOF('Amazon'[Orders Value £]), 0),
    ("Number of Orders", NAMEOF('Amazon'[Number of Orders]), 1)
}

In the formula you can change the description that will show in your slicer (highlighted in green). You need to memorize the number for your measure (highlighted in pink) as we will be using it later:

> Orders value measure = 0

> Number of orders measure = 1



Next, we need to replace the values from our charts with this new parameter, so that when you select the measure using the slicer, this will be reflected on your charts:

ree


Now, we are going to create a few measures that will help us with switching between different colors. First, I'm going to create a measure that will allow me to switch colors on my bar charts. The measure I used is below:

Status color = 
var selected_measure = SELECTEDVALUE('Parameter 1'[Parameter 1 Order])
return
if(selected_measure= 0, "#7FB7BE", "#7A6174")

So this measure will evaluate which measure we have selected in our measures slicer and then, based on the selection, it will retrieve different HEX color codes. If the measure is 0, which means we have selected the Number of orders, then it will retrieve the hex code #7FB7BE, if not (meaning that we have the Orders Value £ selected) then retrieve the hex code #7A6174.


After creating the new measure, we need to define the conditional formatting of our bar chart colors, so that the correct color is showed depending on the measure selection:

ree


The only thing missing now is applying some conditional formatting on the KPI cards, so that we have the KPI card "highlighted" based on the measure selected in the slicer.

To do this, I created 2 extra measures. You can have everything in the same measure, but to keep it simple I decided to build separate measures, one to change the color of the Number of orders KPI card, and another one to change the color of the Order value KPI card.

The logic I applied is the same as the measure I built to change the colors of the bar charts:

Status color Number of Orders = 
var selected_measure = SELECTEDVALUE('Parameter 1'[Parameter 1 Order])
return
if(selected_measure= 1, "#7A6174", "#D5D8DC")
Status color orders value = 
var selected_measure = SELECTEDVALUE('Parameter 1'[Parameter 1 Order])
return
if(selected_measure= 0, "#7FB7BE", "#D5D8DC")

We can go to our formatting pane now and apply some conditional formatting over the background color of our KPI cards:

ree

And that's it! Now we have our report changing colors depending on the metric that we have selected in our slicer!



Pro tip

You can do something similar to switch between light mode/dark mode on your report without leaving the same report page. However, this will be a significant amount of work as you have to apply loads of conditional formatting over your charts (title color, bars color etc).





Interested in learning more about Power BI Report Design? Then the Power BI Report Design Bootcamp is for you!

ree

17 Comments


elden eldery
elden eldery
Dec 29, 2025

skills for data entry are essential for maintaining clear and accurate records. they are

useful in many industries, from finance to administration. consistent data handling supports smooth operations. the college of contract management encourages skill-based learning. students develop practical data management abilities. this supports better workplace organisation.

Like

Joanne Smith
Joanne Smith
Nov 25, 2025

The timeless appeal of leicester red brick has made it a popular choice for construction in the UK for generations. Its durability, fire resistance and classic look make it suitable for many architectural styles. The College of Contract Management provides construction-related courses to help professionals strengthen their knowledge of materials and building techniques. It’s a great step to move your career forward.

Like

gwen mallard
gwen mallard
Oct 28, 2025

The hierarchy of NVQ (National Vocational Qualification) levels defines how expertise grows through practical experience. In exploring nvq3 meaning, The College of Contract Management provides detailed context about its equivalence to academic standards. Such clarity assists learners in aligning their goals with qualification outcomes. The online setting allows continued learning alongside professional duties.

Like

nyla harper
nyla harper
Sep 17, 2025

Into large scale enterprises where functionality intersects with sustainability goals, facilities management services plays an important role in making things run smoothly. At the College of Contract Management, courses are offered with different schedules to fit personal or work situations. Earning new insight into how to earn this certification, UNICCM explains that this role often includes supervising repairs and ensuring compliance.

Like

Dorable yong
Dorable yong
Aug 13, 2025

By using services of architects, developers, and design teams can effortlessly explore design iterations, emphasize material decisions, and present a commercial building's curb appeal with amazing precision. This will unlock the future of bim for architects. Every element, from the eye-catching entrance to the subtle textures, is vividly brought to life with the help of an experienced BIM specialist for architects. This UNICCM-offered course is a crucial step in determining your career trajectory and establishing your impact on the developing architecture of excellence.

Like
datapeers.png

Address

71-75 Shelton Street, Convent Garden

WC2H 9JQ London

© 2025 by Data Pears Consulting. All rights reserved.

bottom of page