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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Enable text style formatting inside DAX for more power

Hi Community,

 

In Power BI, conditional formatting affects the whole cell - therefore, all concatenated values receive the same style. Because of this you cannot highlight or emphasize separate parts of the text, which lowers readability and weakens the story.

 

Current limitation
ConcatenatedValue =
[Area] & " - " & [Components] & " - " & [Issues]

#004 IdeasOBaz 01.jpg

 

I introduce a new DAX function, for example TextStyle() or RichText(), that lets developers give parts of a joined string their own color or style, like bold, italic or underline.

 

The function would apply the format only to the chosen pieces - one cell can hold one string that shows multiple kinds of text treatment right away.

 

Proposed enhancement
ConcatenatedValue =
TextStyle([Area], "Color=Black;Bold=True") & " - " &
TextStyle([Components], "Color=Red;Condition=ConditionMeasure") & " - " &
TextStyle([Issues], "Color=Blue;Italic=True")

#004 IdeasOBaz 02.png

 

This feature would add to the current conditional formatting - letting users control the color of each part of a text string. In this way Power BI visuals become more powerful, colorful and easy to use.

 

Thanks for voting 🙌 Together we’ll make Power BI better.

🟩 Follow me on LinkedIn

 

#IdeasDataVitalizer

Status: New
Comments
Joe_Barry
Super User
It is possible at the moment using HTML. You can use the HTML Content visual by Daniel Marsh-Patrick. You can write the HTML code into the measure or create a DAX UDF if you have a standard formatting across measures. I have no HTML experience and Co-Pilot provided the correct guidance. I was able to add Bold Font and conditional formatting on Text. Below is a sample of a measure I created. VAR TargetText = SWITCH( TRUE(), [Test Measure % from Target] >= 1.10, " ( " & pbi.ConditionalFormat(1) & " ↑ " & Test MeasureVar & " vs " & Test MeasureTarget & " Target )", [Test Measure % from Target] >= 1 && [Test Measure % from Target] < 1.10, " ( " & pbi.ConditionalFormat(2) & " ↗ " & Test MeasureVar & " vs " & Test MeasureTarget & " Target )", [Test Measure % from Target] >= 0.90 && [Test Measure % from Target] < 1, " ( " & pbi.ConditionalFormat(3) & " → " & Test MeasureVar & " vs " & Test MeasureTarget & " Target )", [Test Measure % from Target] >= 0.80 && [Test Measure % from Target] < 0.90, " ( " & pbi.ConditionalFormat(4) & " ↘ " & Test MeasureVar & " vs " & Test MeasureTarget & " Target )", [Test Measure % from Target] < 0.80, " ( " & pbi.ConditionalFormat(5) & " ↓ " & Test MeasureVar & " vs " & Test MeasureTarget & " Target )", "" )