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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Composed_MS
Helper I
Helper I

Color change for specific text in card visual

Hello,

 

I need to change the color of specific text in the card visual, as you can see below 2.8% is increased that's why it's green and 210bps is decreased hence red.

 

Composed_MS_0-1684410933192.png

 

This whole line I am writing in measure and then putting it in card visual. 

Is it possible to color code only that many parts (2.8% and 210bps) in the card?

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @Composed_MS 

When faced with these situations, I tend to reach for a simple solution that just works.
Uses a text box to combine two cards and apply conditional formatting rules.
As follows:

1.The text box is prepared and places where cards will go. I just type a string of strings that will save me space for the cards according to their maximum character limit:

Ritaf1983_0-1685501133588.png

2. Creating each card with its conditional format, white background and cleaning everything that takes up space, and changing the border padding to eliminate white spaces

Ritaf1983_1-1685501411214.png

Ritaf1983_2-1685501531574.pngRitaf1983_3-1685501596506.png

 

Ritaf1983_4-1685501657067.pngRitaf1983_5-1685501709905.png

3.I attach the cards to the places I saved them once they are designed

Ritaf1983_6-1685501835584.png

 

4. Grouping all created "construction"

Ritaf1983_7-1685501902946.png

Link to sample file 

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

11 REPLIES 11
ecalzavara
Advocate II
Advocate II

Same issue here. It'd be good to be able to use FORMAT()... I don't think the answer marked as a solution is the solution... Is a workaround, but not always usable...

Ritaf1983
Super User
Super User

Hi @Composed_MS 

When faced with these situations, I tend to reach for a simple solution that just works.
Uses a text box to combine two cards and apply conditional formatting rules.
As follows:

1.The text box is prepared and places where cards will go. I just type a string of strings that will save me space for the cards according to their maximum character limit:

Ritaf1983_0-1685501133588.png

2. Creating each card with its conditional format, white background and cleaning everything that takes up space, and changing the border padding to eliminate white spaces

Ritaf1983_1-1685501411214.png

Ritaf1983_2-1685501531574.pngRitaf1983_3-1685501596506.png

 

Ritaf1983_4-1685501657067.pngRitaf1983_5-1685501709905.png

3.I attach the cards to the places I saved them once they are designed

Ritaf1983_6-1685501835584.png

 

4. Grouping all created "construction"

Ritaf1983_7-1685501902946.png

Link to sample file 

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

Hello Ritaf, 

 

have a great day!
I have used this solution when i got the color code work, but my client uphappy with this work, they are expecting the colors to text only when we add the values into text should reflect the colors dynamically, is there any alternate method, please share with me.

 

Thanks,

Arjun Reddy

AmiraBedh
Most Valuable Professional
Most Valuable Professional

Maybe it is time to explain to your client that Power BI is a powerful tool to be exploited in a careful way.
Good luck with that 🙂


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Hello @Ritaf1983 
The issue with this one is I am having around 70 lines with above 50 numbers of green or red color in it.
So making it will be a lot of rework.
But thanks a lot for this much effort.

Composed_MS
Helper I
Helper I

I tried HTML visual for this and made the text colored using HTML code. It worked as well but the issue is that the visual is not supported to export.
There's no free HTML visual, which is Power BI certified. We want users to export the page to pdf or ppt.

Composed_MS
Helper I
Helper I

@amitchandak @lbendlin @Ritaf1983 
Could you please help me with this one

AmiraBedh
Most Valuable Professional
Most Valuable Professional

Create a measure that calculates the desired value and includes the text with color coding. For example : 

yourMeasure = SUM(yourTable[Column])
 
In the "Conditional formatting" pane, choose the "Based on field value" option and select the measure you want to apply formatting to, in your case yourMeasure.
Click on the "+" icon to add a formatting rule. In the "Value" field, enter the specific text you want to format.
Choose the desired formatting options, such as font color, background color, or font style, for the selected value.

Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

I am using the whole line as a single measure, which is dynamic according to selection.
In measure, I wrote it using & operator so that my text gets concatenated.
Increase and decrease are dynamic which I coded in the measure itself.
So in that measure for these two numbers I need to color code and other words should remain black colored only. @AmiraBedh 

AmiraBedh
Most Valuable Professional
Most Valuable Professional

Can you please share your pbix file ? or at least the code of your measure?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Measure->

 

"TO has "

&

SWITCH([TO CY vs PY],
"#71CE0D","increased",
"#E80054","declined")

& " by " & FORMAT([TO CY vs PY],"Percent")

& " and there’s an " &

SWITCH([head CY vs PY],
"#71CE0D","increment",
"#E80054","decrement")

&" of " & FORMAT([head CY vs PY]*100,"0.0") &"bps in headcount percentage from "& [Vs PY Quarter]

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.