Forum Discussion

UncleLewis's avatar
UncleLewis
Responsive Resident
1 year ago
Solved

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



Thanks,

-w

  • 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.

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

    2. put it on back of the card:

    3. switch off the card background

    4. Group

    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

  • Hey UncleLewis ,

     

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

     

    Regards,

    Tom

2 Replies

  • Hey UncleLewis ,

     

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

     

    Regards,

    Tom

  • 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.

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

    2. put it on back of the card:

    3. switch off the card background

    4. Group

    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