Power BI - images the smart way, without URLs or graphics files!!!
Art Tennick
??3 US Patents in BI??technical editor 4 Packt Power BI books??author 20 computer books??Power BI??Analysis Services??Python/R in Power BI??Paginated??MDX DAX SQL Python R TMDL??ex-university SQL lecturer??35 years in BI
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)??