Power BI - images the smart way, without URLs or graphics files!!!
Images without URLs

Power BI - images the smart way, without URLs or graphics files!!!

these images are not messy URLs, they are from a varbinary column in a SQL Server database (Adventure Works DW DimProduct table)

use SQL to extract the varbinary column as Base64, use DAX to add Base64 header

the varbinary columns can easily be created automatically from graphics files with the SSIS Import Column transformation

no need to create URL for every single image (and they have to be on public website or unsecured OneDrive to work anyway)

no need to use a Base64 encoder for each image

here is the SQL to get the varbinary image:

select ProductKey, EnglishProductName as Product, modelname as Model, Size, Color, cast('' as xml).value('xs:base64Binary(sql:column("dimproduct.largephoto"))', 'varchar(max)') as [Image] from dimproduct

you have to double up the double quotes around dimproduct.largephoto if you type directly or paste into M

here is the DAX to add the header*: Base64 = "data:image/jpeg;base64," & [Image]

here is the pbix, if you want to play: https://lnkd.in/eRytfYV

*using DAX results in an extra column, so for larger tables add the header in the SQL - the SQL uses XML, but I think you could also use JSON (OpenJSON)??




要查看或添加评论,请登录

Art Tennick的更多文章

社区洞察

其他会员也浏览了