Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
UncleLewis
Responsive Resident
Responsive Resident

Set Reference Label Background Color Conditionally

Hi all,

Using PBID Oct, 2024.

How can I set the color just behind the Reference Label of the KPI Card New?
I added my DAX to background of the reference label, but that turned the entire reference label area a muted red,
I want the color to be only behind the text of the reference label.

PBIX is here

ref lbl color.png

Thanks,

-w

2 ACCEPTED SOLUTIONS
Ritaf1983
Super User
Super User

Hi @UncleLewis 

You are unable to provide the desired background to the label text only because, from the engine's perspective, the label ref is considered the entire area of the region, not just the text itself.

As a workaround, what you can do is detach the background color from the card and create a rectangle with conditional formatting settings using the DAX you created. This way, you will get a result like in the picture.

Ritaf1983_0-1729057000052.png

The modifications that I did to achieve :
1. Create a rectangle with your dax measure as a fill color :

Ritaf1983_1-1729057090407.png

2. put it on back of the card:

Ritaf1983_2-1729057137173.png

3. switch off the card background

Ritaf1983_3-1729057213054.png

4. Group

Ritaf1983_4-1729057244474.png

Note that the rectangle's size is not dynamic, so if the string can change in length, the rectangle should account for this in its length in advance

The pbix is attached 

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

TomMartens
Super User
Super User

Hey @UncleLewis ,

 

This is not possible; the background color for the reference label is coloring the entire area of the reference label.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey @UncleLewis ,

 

This is not possible; the background color for the reference label is coloring the entire area of the reference label.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Ritaf1983
Super User
Super User

Hi @UncleLewis 

You are unable to provide the desired background to the label text only because, from the engine's perspective, the label ref is considered the entire area of the region, not just the text itself.

As a workaround, what you can do is detach the background color from the card and create a rectangle with conditional formatting settings using the DAX you created. This way, you will get a result like in the picture.

Ritaf1983_0-1729057000052.png

The modifications that I did to achieve :
1. Create a rectangle with your dax measure as a fill color :

Ritaf1983_1-1729057090407.png

2. put it on back of the card:

Ritaf1983_2-1729057137173.png

3. switch off the card background

Ritaf1983_3-1729057213054.png

4. Group

Ritaf1983_4-1729057244474.png

Note that the rectangle's size is not dynamic, so if the string can change in length, the rectangle should account for this in its length in advance

The pbix is attached 

 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors