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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Users online (23,836)