Icons In Power BI | DAX, UNICHAR, UNICODE & Custom Images

by | Power BI

Icons in Power BI are used to communicate meaning and add more context. You can use them as an infographic element to enhance your design or use conditional formatting in tables and metrics, directly from the visualization pane.

An even more powerful way to control icons in tables and metrics is by leveraging the measures index. By using this, you could use UNICHAR, UNICODE, or any other custom icons you want. Through the use of these, you can enrich the context and show the trend for each row category.

icons in power bi

As an illustration, let’s take a look at this report.

We have the list of the warehouses and the percentage of the scanning invoice in descending order. We also have some star icons.

To create these, go to % Scanned, select Conditional formatting, and then Icons.

I made an IF statement on the % Scanned that if it is above or equal to 53% and less than 100%, we have this full star. If we are above 50% and below 53%, then we have a half-star. Lastly, if we are above or equal to zero and below 50%, then we have this empty star.

This works nicely, but it’s a bit limited because we do not have many choices in terms of icons. It is also difficult to see that the icons are coming from conditional formatting because we have to do a couple of clicks first in order to get there.

Create Icons In Power BI With DAX Measures

In this situation, the better way to do this is by using DAX measures. If we look inside the measures that I created, the codes that can replace this conditional formatting are the following.

After validating the measure, we can now go to back to Conditional formatting and then select Icons.

Under Format style, instead of using Rules which are not documented anywhere and are difficult to follow, we can use Field value and base it on the rule that I created which is CF_Icons_2.

Once completed, we can see that there’s no change in terms of visualization, but now it is easier to follow because this is the formula that controls everything.

For example, let’s change the first condition to 0.55, then the second condition to 0.53 and validate these. Noticeably, we only have half star for the 54.8% because we set the values to have full star if it’s above 55%.

One of the advantages is it’s also much easier to transfer from one Power BI developer to another because it is more straightforward. In this case, it’s easier to document and reproduce if you have other projects based on the same conditions. It is much easier to copy paste this code and reuse it.

icons in power bi
icons in power bi

In addition, I have a cheat sheet page that shows all the icons inside Power BI desktop with their name. It’s very practical to use because I know exactly how I can write them by these codes and the icons that they represent.

icons in power bi

Create Icons In Power BI With UNICHAR Codes

The second example that I created is the UNICHAR code.

We have the UNICHAR formula with the same code. I also added two variables that show the minimum and maximum of the warehouse percentages.

I also used the SWITCH function with different conditions and the corresponding UNICHAR icon will appear depending on the conditions met.

The problem with UNICHAR is that we don’t know what these codes mean and what kind of icons they will show. Although it is another way to add icons that are not inside the Power BI desktop.

icons in power bi

Let’s see what UNICHAR icons we have by toggling on the Background.

We have some icons here that do not exist inside the Power BI desktop, where we can choose icons with color, and icons that are smaller or bigger. It’s very practical because it gives us the possibility to be more creative when we use icons.

icons in power bi

You can also choose from a variety of UNICHAR codes. It’s an Excel file that has all kinds of signs, arrows, traffic lights, and more that you can use as inspiration for your reports.

Create Icons In Power BI With UNICODE Codes

Next is another example which uses UNICODE. Similar to UNICHAR, we can bring our own icons with different colors, sizes, and shapes.

icons in power bi

As shown below, when we look at the codes of UNICODE, it is better than the UNICHAR because we already see the image that we can copy and paste directly into the code. It’s very nice because we can see the actual icons which are good for documentation.

I also included a website for inspiration in case you are looking for UNICODES. Let me show you how it’s done.

From the Unicode-table.com site, let’s search for a star then open the black star. We can see the code and copy it or simply select the icon and copy it from there.

icons in power bi

Then, go back to Power BI then paste the icon in the form. This is also a neat way to add specific icons inside Power BI.

icons in power bi

Custom Icons

There’s also another custom solution for adding icons inside Power BI. Go to Conditional formatting then select Icons. After that, choose the CF_Icons_3 measure.

icons in power bi

As you can see, like on the other examples, we can choose icons of different colors, sizes, and shapes. These are based on BASE64 images.

icons in power bi

To do this, go to the Flaticon.com website. What I did is to search for different icons and chose diamonds. I selected and downloaded these as PNG. Then, I chose a smaller size like 24 or 32 pixels.

Afterwards, I went to the Base64-image.de, which is a drag & drop site. I selected the icons that I downloaded on this page. I changed them to 32 pixels and converted the icons into BASE64 images.

I copied and pasted the image codes.

Then set the Data category to the Image URL to make it work.

The codes and images are now added to the Power BI desktop.

***** Related Links *****
Power BI Custom Icons | PBI Visualization Technique
Power BI Report Development: Creating Themes, Company Logos, Icons and Backgrounds
How To Add Custom Power BI Icons Into Your Reports

Conclusion

The best way to create icons inside Power BI is to create measures. It’s much easier to transfer, document and reuse.

Lastly, if you need to add custom icons, try to use UNICODE. It’s the easiest way to add icons. And if you need some icons that are unique, then use the BASE64 images and add the image URL directly.

All the best,

Alex Badiu

Related Posts