Display employee images from Dynamics 365 F&O/ HR in Power BI

Display employee images from Dynamics 365 FO HR in Power BI

Display employee images from Dynamics 365 F&O/ HR in Power BI

A good way to enhance your reports is to add images to them. Static images on the page are good for some purposes. But sometimes you want images that relate to the data in your report. 

In this article, we will see how to display images from Dynamics 365 F&O/ Human resources in Power BI. Dynamics 365 F&O/HR has images in binary format and This is not possible to display images to Power BI directly. There is a workaround where you can transform those images and display in Power BI. We will use Person image entity as a example and connection type will be odata.

Step 1 : Connect to Power BI.

Step 2 : Get data > Odata > Provide odata url for PersonImage entity

Sample URL from Dynamics 365 HR

https://xxx-prod-northeurope.hr.talent.dynamics.com/namespaces/xxx/data/PersonImages

Step 3 : Click on transform data

Step 4: In Power BI, The data should display in below format.

image 5

Step 5 : Transformation

Get name from Person

First expand Person and select Name and click ok.

image 6

It will show Name of Person.

image 7

Convert binary to Image

The current format of image is binary and first, we will convert to text.

Click on curser just next to label Image and select Text.

image 8

Now, Image type changed to text.

image 9

Click on Add column > custom column

image 10

Using the Binary.ToText function the binary column has now been converted to a Base64 string. This is important, as a standard non-Base64 conversion will not work. However, we are still missing the prefix that makes it a URL. A second calculated column using the following formula will get us to a usable URL column:

“data:image/jpeg;base64, ” & [YourImage]

If you are converting png files, the code you would use is:

“data:image/png;base64, ” & [YourImage]

image 11

The final step is to set the Data Category of the ‘ImageURL’ column to “Image URL” so that Power BI will recognize it as a URL rather than regular text and display the image.

Click close and apply.

image 12

Go to Home > Select Employee image

image 13

Click on the Data category dropdown and select Image URL option.

image 14

Once this is done then employee image converted to Image URL and ready for use in Power BI.

image 15

Now drag and drop fields from tables to visual and data will looks like below.

image 16

Limitations

  • There is one major limitation to using this technique and it stems from the string length allotment in Power BI. Power BI has a maximum string length of 32,766 characters. This causes issues when trying to embed large images.
  • The image needs to be in one of these file formats: .bmp, .jpg, .jpeg, .gif, .png, or .svg

If you like this article, feel free to share it with others who might find it helpful! If you have any questions, feel free to reach out to me.

Parag Chapre

Parag Chapre is a Microsoft MVP in the fields of Dynamics 365 Finance & Operations, Human Resources, and Power Platform, recognized for his outstanding contributions to the Microsoft Dynamics community.

With over 15 years of hands-on expertise in various Microsoft Dynamics 365 areas, Parag has designed and delivered complex, innovative solutions for customers across industries and geographies. He has also provided leadership and technical guidance to project teams, managed offshore and onshore resources, and worked closely with Microsoft Product teams. Parag is passionate about sharing his knowledge and insights through his personal website, blog posts, articles, and community events. He is a member of the Microsoft Biz Apps Community Advisory Board, a Dynamics 365 Human Resource Community star, a Dynamics 365 Community contributor, and a Dynamics 365 Community Spotlight honoree.

2 Comments

Leave a Reply