When exploring and analyzing data, we may need to add colored icons to help us visually identify patterns and trends. Currently,there are two main ways to add icons. 1. Icon sets for conditional formatting
a) built-in icon sets b) custom icon sets (json file of theme) 2. Conditional fields a) SVG xml, Img URL, Built-in icon name b) Html-code of Unicode characters
Here are some tips for the methods:
#1 Icon sets for conditional formatting a) built-in icon sets Icon sets for table and matrix is a feature of KPI icons released in July 2019. Currently, over 20 styles and 60 standard icons are available in the set. For more details, please refer to the screenshot below provided by Francisco Mullor Cabrera.
To show icons based on cell values, you can turn on icons for your table or matrix just like any other conditional formatting feature, either through the contextual menu for the field you want to apply it to or through the conditional formatting card in the formatting pane.
b) custom icon sets (json file of theme) You can change icons or add new icons to the icon sets through a theme file. The following is a sample provided Power BI Desktop July 2019 Feature Summary. The code inside explains how to add new custom icons to the theme.
In addition to using the icon sets, we can create conditional fields to display icons in seperated columns. Conditional fields can convert some image information into icons, such as SVG xml, Img URL, built-in icon name, Html-code of Unicode character.
Points to note: 1. As mentioned in the official document , the images displayed in report table visual need to be in one of these file formats, .bmp, .jpg, .jpeg, . gif, .png, or .svg. The URL needs to be anonymously accessible, not on a site that requires a sign-in, such as SharePoint. However, if images are hosted on SharePoint or OneDrive, you may be able to get an embed code that points directly to them.
2. Although we can apply our conditional fields as the rules(field value) of conditional formatting, this is likely to cause image loss. As of now, conditional fields which have beed created based on svg xml or Unicode characters may not display icons properly when we apply them conditional formatting (format by ‘Field value’).
b) Html-code of Unicode characters Among all types of conditional fields, conditional fields created by Unicode characters is undoubtedly a special existence, they behave as excellently like ordinary text characters in many aspects.
Unicode organizes and encodes most of the world's writing systems and each symbol has its own HTML-code. In Power BI, we can use UNICODE(<text>) function to parse the HTML-code and display the corresponding Unicode symbol.
For example: the HTML-code of white medium star is ⭐.
Unicode can be regarded as a text character, so function ‘rept’ and ‘&’ are also applicable to it.
For some Unicode characters ,you can change the font color in the format pane as well. For example, Unicode only contains a red up or down arrow. You can’t find green arrow in the list.
In this case, it’s hard to directly call Unicode to solve it. As a workaround， we could use (▲) grey up arrow and then convert it into green under the column style.
We can also apply conditional formatting to the font color of these conditional field. Sample：
The above are just some of the methods I use, each of the methods has advantages and disadvantages. For example, icon styles available in icon sets are limited, but they are easy to use directly. Conditional fields has expanded icon style, but you need to pay attention to whether the information in Dax can be correctly converted into icon. Invalid URL links and incorrectly formatted SVG xml code may prevent you from displaying the icon you want.
Hope the above content can help you better understand the icon in Power BI.