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
Step 3 : Click on transform data
Step 4: In Power BI, The data should display in below format.
Step 5 : Transformation
Get name from Person
First expand Person and select Name and click ok.
It will show Name of Person.
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.
Now, Image type changed to text.
Click on Add column > custom column
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]
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.
Go to Home > Select Employee image
Click on the Data category dropdown and select Image URL option.
Once this is done then employee image converted to Image URL and ready for use in Power BI.
Now drag and drop fields from tables to visual and data will looks like below.
- 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.