Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Martin_D
Super User
Super User

SVG image doesn't load bitmap URLs

Hi,


I've created a measure that returns SVG code that loads bitmap images from a web-server to include them in the SVG image. I know the SVG code is correct, because it shows the correct image in the "HTML Content" custom visual. But when using Power BI built in visuals, it doesn't load the images. They appear broken.

Does anyone know a way to fix this, e.g., by storing the files in a specific, allowed location, e.g., a SharePoint in the same tenant, crafting a specific URL or something? Embedding the base64 encoded bitmap images into the measure wasn't an option because the string length exceeds the buffer length so it doesn't work.

This is the measure code:

"data:image/svg+xml;utf8," &
"<svg width='388' height='325' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>
    <image x='0' y='240' width='38' height='325' xlink:href='https://github.com/MartinBubenheimer/powerbi-solutions/blob/main/svg/assets/Stick.png?raw=true' />
    <image x='70' y='210' width='38' height='325' xlink:href='https://github.com/MartinBubenheimer/powerbi-solutions/blob/main/svg/assets/Stick.png?raw=true' />
    <image x='140' y='140' width='38' height='325' xlink:href='https://github.com/MartinBubenheimer/powerbi-solutions/blob/main/svg/assets/Stick.png?raw=true' />
    <image x='210' y='90' width='38' height='325' xlink:href='https://github.com/MartinBubenheimer/powerbi-solutions/blob/main/svg/assets/Stick.png?raw=true' />
    <image x='280' y='110' width='38' height='325' xlink:href='https://github.com/MartinBubenheimer/powerbi-solutions/blob/main/svg/assets/Stick.png?raw=true' />
    <image x='350' y='4' width='38' height='321' xlink:href='https://github.com/MartinBubenheimer/powerbi-solutions/blob/main/svg/assets/Cracker.png?raw=true' />
</svg>"

 

And this is the result in a new card visual:

Martin_D_0-1731497048270.png

It shows four broken images, that's not your browser 😉

Kind regards,
Martin

1 ACCEPTED SOLUTION

Well, you know the spiel - If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com

 

Or you could treat it as a bug - If you have a Pro license you can open a Pro ticket at https://admin.powerplatform.microsoft.com/newsupportticket/powerbi
Otherwise you can raise an issue at https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues .

View solution in original post

5 REPLIES 5
Martin_D
Super User
Super User

I think it's a feature 😉 As long as nobody locks me out of the HTML Content custom visual I'll try to stick to this workaround.

lbendlin
Super User
Super User

Inline the images as Base64 strings. Split the strings into pieces smaller than 32K and then put them back together in the measure.

 

https://blog.crossjoin.co.uk/2019/05/19/storing-large-images-in-power-bi-datasets/

 

You will need to use a link to the actual raw file.

 

lbendlin_0-1731503918325.png

 

You can also try to inline these into the SVG

 

Does SVG support embedding of bitmap images? - Stack Overflow

 

But that may also not work with the built-in visuals.

Hi @lbendlin ,


Thank you for looking into this issue. I should have mentioned that my semantic model uses calculation groups. All you described works in models without calculation groups, but as mentioned in the comments of your referenced article, your solution is not compatible with calculation groups in the same semantic model (same as default auto aggregations, but as Microsoft users we tend to call such behaviour "feature", don't we? 😉). Or, more precise, the original idea of Chris Webb was to overcome a limit of how much text you can load into one text field in the database, not to overcome a limit in DAX measures. With calculation groups in the same model, the text limit for a measure is the same as the text limit for a text field in the database, so it becomes obsolete in this case. See: Chris Webb's BI Blog: Storing Large Images In Power BI Datasets

 

That's why I was rather following the URL linked image approach rather than the URL embedded image approach. Any idea whether this could work under specific constraints or circumstances?

Kind regards,
Martin

Update: Power BI can access the image files and accepts them if I create a measure only containing the URL of one image. Then the image appears, e.g., in a Matrix visual. It only does not appear when the link is used inside of the SVG code.

 

When embedding an image (that is small enough) in the SVG code, it also shows up correctly.

 

So the following works:

 

  • Loading an image from a URL link into a standard visual
  • Showing bitmap images as part of DAX generated SVG code, as long as the image is embedded
  • Showing the SVG image including bitmap images that are loaded from URL links inside of the SVG code by using the "HTML Content" custom visual

Now what is missing is the combination:

 

  • Loading an image from a URL link within DAX generated SVG code and showing it in Power BI standard visuals (new card visual, matrix, table)

Without further ado such images appear as broken.

Well, you know the spiel - If this is important to you please consider voting for an existing idea or raising a new one at https://ideas.fabric.microsoft.com

 

Or you could treat it as a bug - If you have a Pro license you can open a Pro ticket at https://admin.powerplatform.microsoft.com/newsupportticket/powerbi
Otherwise you can raise an issue at https://community.fabric.microsoft.com/t5/Issues/idb-p/Issues .

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.