Tips on displaying icons based on field values in …


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.


     "name": "CustomIcons",

     "icons": {

         "fire": {

         "url": "https://i. gifer. com/Omjx. gif",

         "description": "Fire!"


         "explosion": {

"url": "https://i. gifer. com/3iCN. gif",

"description": "Boom!"


        "StarMediumLight": {

"url": "https://www. uscsd. k12. pa. us/cms/lib/PA01000033/Centricity/Domain/1/library-icon. png",

"description": {"resourceKey": "Icon_ColoredArrowUpRed"}






#2  Conditional fields

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.

a) SVG xml, Img URL, Built -in icon name
Sample code provided in Power BI Desktop July 2019 Feature Summary:

Icon Set Measure =



SUM(Sales[Units]) < 200, "data&colon;image/svg+xml;utf8, <svg xmlns="https://www. w3. org/2000/svg" viewBox='0 0 100 100'> <circle cx='50' cy='50' r="40" stroke="purple" stroke-width="4" fill="purple" /> </svg>", // svg xml

SUM(Sales[Units]) < 1000, "StarMediumLight", //built-in icon name

https://i. gifer. com/Omjx. gif //Img URL



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 &#11088.



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 (&#9650) 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.






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. 


Author: Eason Fang

Reviewer: Ula Huang, Kerry Wang

Source link

Be the first to comment

Leave a Reply

Your email address will not be published.