Bold, italic, underline etc.
One of the best ways to highlight certain parts of text is by formatting it differently. In this article, we'll look at how to use some basic HTML tags to format text or values in Power BI.
This article only focuses on the HTML tags but of course, all this could be made dynamic by combining DAX and HTML as you can see in the report below, where you can select which style you'd like to see. All this is just the tip of the iceberg. After going through some more of the articles in this knowledge base, you will be able to do great things with the visual!
These are the HTML tags for basic formating:
- <b> = bold
- <i> = italic
- <u> = underline
- <s> = strikethrough
This means that whenever you want to add one of these formatting styles, you add the HTML tag in front of the text like this <b>this text is bold What you also do is that you close the HTML tag again to make sure, following text is not bold anymore. <b>this text is bold</b> this text is not bold
How to use the HTML tags in a DAX measure
Let's assume your measure is called "Bold Text" and should show the words "Hello World" in bold. The measure would look like this:
Bold Text = "<b>Hello World</b>"
Note that in this example, you only need to have double quotation marks in the beginning and in the end. If you want to make the text dynamic by taking it from a table or measure in your data model, you would proceed a little bit differently. Let's assume your measure is called "This is the text", then the DAX code would look like this: