Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
I'm very new to power BI and am working with a dashboard passed on to me by a contactor who was a power user.
Is it possible to contionally change the font color of a dynamic % value surrounded by other static text that should be black. All of it is part of a text measure. A slicer controls the value. Desired output below:
Text text text 3% text text text.
Text text text -16.08% text text text.
The measure is currently defined like this: BParamText = "Text text text " & BParam[BParam Value] * 100 & "% text text text."
I've tried conditonal formatting but that obviously turns the whole text string green or red, not just the value.
I've also tried dividing everything into 2 separate elements, just the value by itself (conditonally formatted) with a plain text box around the value, but that creates weird gapping/overlapping when the numbers are long like -20.08% or short like 8%. Screen shots:
Any ideas? Thank you!!!
Solved! Go to Solution.
Hi @ustpowbi
If you use this visual HTML Content - Custom Visual for Power BI (html-content.com) you can do it.
After installing the visual, add one to the page.
I've set up a dummy measure
HTML Measure =
VAR _Value = SELECTEDVALUE('DataTable'[Value])
VAR _StartText = "There are <style> span "
VAR _EndText = "</span> widgets in the selected category."
RETURN
IF ( _Value > 0, _StartText & "{color:#48e21a;} </style><span>" & _Value & _EndText, _StartText & "{color:#ff0000;} </style><span>" & _Value & _EndText )
to work with this data
Text color is controled by the hex color code e.g. #ff00000.
You'll need to modify your code to suit your needs.
Regards
Phil
Proud to be a Super User!
Hi, I need to export the Power Bi file to ppt in Power BI Service. But since html content custom visual does not allow that, I have an error wherever I have used it in the page. Is there any workaround for this?
Hi @Anonymous
Please start a new topic for this issue.
Regards
Phil
Proud to be a Super User!
Hi @ustpowbi
If you use this visual HTML Content - Custom Visual for Power BI (html-content.com) you can do it.
After installing the visual, add one to the page.
I've set up a dummy measure
HTML Measure =
VAR _Value = SELECTEDVALUE('DataTable'[Value])
VAR _StartText = "There are <style> span "
VAR _EndText = "</span> widgets in the selected category."
RETURN
IF ( _Value > 0, _StartText & "{color:#48e21a;} </style><span>" & _Value & _EndText, _StartText & "{color:#ff0000;} </style><span>" & _Value & _EndText )
to work with this data
Text color is controled by the hex color code e.g. #ff00000.
You'll need to modify your code to suit your needs.
Regards
Phil
Proud to be a Super User!
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 40 | |
| 38 | |
| 21 | |
| 20 |
| User | Count |
|---|---|
| 142 | |
| 105 | |
| 63 | |
| 36 | |
| 35 |