Storing Large Images In Power BI Datasets

Jason Thomas and Gerhard Brueckl have both blogged on the subject of storing images as text inside a Power BI dataset:

http://sqljason.com/2018/01/embedding-images-in-power-bi-using-base64.html

https://blog.gbrueckl.at/2018/01/storing-images-powerbi-analysis-services-data-models/

Since they wrote those posts, however, Power BI has added the ability to set the Data Category property on measures as well as columns in tables. This means it is now possible to have the output of a DAX measure displayed as an image in a Power BI report and this in turn opens up a lot of new possibilities – including the ability to work around the maximum size of a text value that can be loaded into Power BI (see my previous blog post for more details) and therefore work with larger images.

Here’s a rather lovely picture of a rose:

2014-08-18 17.02.10_20Pct

The original is about 2.1MB; I have a folder on my PC where different versions of this picture, saved at different percentages of the original size, are stored:

image

Using the technique that Gerhard wrote about, where the pictures can be stored as text in a single cell in a Power BI dataset and then displayed (in this case I’m using the Image by CloudScope custom visual) some truncation of the image occurs even with the smallest files because of the 32766 character limit on the length of a text value that can be loaded into Power BI. Here’s what you see when you display the version of the picture that is 20% of the original size, a file of only 113KB:

image

To work around this, what you need to do is to split the text representation of the image up into multiple smaller text values stored across multiple rows, each of which is less than the 32766 character limit, and then reassemble them in a DAX measure after the data has been loaded.

Splitting the text up in M is actually not that hard, but it is hard to do efficiently. Here’s an example of an M query that reads all the data from all of the files in the folder above and returns a table:

let
  //Get list of files in folder 
  Source = Folder.Files("C:\Users\Chris\Documents\PQ Pics"),
  //Remove unnecessary columns 
  RemoveOtherColumns = Table.SelectColumns(Source, {"Content", "Name"}),
  //Creates Splitter function 
  SplitTextFunction = Splitter.SplitTextByRepeatedLengths(30000),
  //Converts table of files to list 
  ListInput = Table.ToRows(RemoveOtherColumns),
  //Function to convert binary of photo to multiple 
  //text values 
  ConvertOneFile = (InputRow as list) =>
    let
      BinaryIn    = InputRow{0},
      FileName    = InputRow{1},
      BinaryText  = Binary.ToText(BinaryIn, BinaryEncoding.Base64),
      SplitUpText = SplitTextFunction(BinaryText),
      AddFileName = List.Transform(SplitUpText, each {FileName, _})
    in
      AddFileName,
  //Loops over all photos and calls the above function 
  ConvertAllFiles = List.Transform(ListInput, each ConvertOneFile(_)),
  //Combines lists together 
  CombineLists = List.Combine(ConvertAllFiles),
  //Converts results to table 
  ToTable = #table(type table [Name = text, Pic = text], CombineLists),
  //Adds index column to output table 
  AddIndexColumn = Table.AddIndexColumn(ToTable, "Index", 0, 1)
in
  AddIndexColumn

In my next post I’ll show you my original version of this query, explain why it was slow, and try to explain how the version above works and why it is much faster.

Here’s what the query above returns:

image

The Pic column contains the split text values, each of which are less than the 32766 character limit, so when this table is loaded into Power BI no truncation occurs. The index column is necessary because without it we won’t be able to recombine all the split values in the correct order.

The only thing left to do is to create a measure that uses the DAX ConcatenateX() function to concatenate all of the pieces of text back into a single value, like so:

Display Image = 
IF( HASONEVALUE('PQ Pics'[Name]), 
"data:image/jpeg;base64, " & 
CONCATENATEX( 'PQ Pics', 'PQ Pics'[Pic], , 'PQ Pics'[Index], ASC) )

…set the data category of this measure to be “Image URL”:

image

…and then display the value of the image in a report:

image
image

Unfortunately, as I also mentioned in my previous post, most DAX functions (and that includes ConcatenateX()) have a limit of around 2.1 million characters so the original 2.1MB file still can’t be displayed, alas:

image

However, I do think this technique will be useful because it allows you to work with much larger pictures than before.

It can also be useful in other situations too. I recently came across a great new custom visual called PDF Viewer that can display PDF files stored in text form in a Power BI report:

image

The example file for this visual shows how a large PDF file can be split across two columns in a table; the technique I describe here is a more practical solution to this problem.

[Update 14th June 2023: the new card visual in Power BI, announced here https://powerbi.microsoft.com/en-us/blog/new-card-visual-public-preview/, supports ImageURLs too as Armand van Amersfoort shows in this video: https://www.youtube.com/watch?v=XkFJFO6p-eE%5D

107 thoughts on “Storing Large Images In Power BI Datasets

  1. I tried it, but the meansure return a empty field.

    Do you have a video explain that?

      1. I have the same problem that ALEHQUIZ mentions. The measure is blank!
        * query load data table images its ok…

  2. This looks great, perhaps I am doing something wrong but when I drop your code in as a querie while changing the folder path it doesn’t generate a table. I could potentially split up the code to make it work but wanted to check if there’s something obvious I am missing. I have it working from Gerhard’s post.

    1. Ignore this!

      Advanced editor did the trick was trying to build it as a function before.

  3. Thanks Chris! now its ok! (using the custon visual “Image by CloudScope”)

  4. Hi Chris,

    Just to check, this method is only for “Import” or it is works in “Direct Query” mode as well?

    Thanks

  5. I’ve followed the steps but when I try to drag the ‘Display Image’ field to the image field in the Chiclet Slicer visual, it doesn’t take it. Does this not work with Chiclet Slicer?

    I have images loaded but, despite them being around 50kb or less, they are truncated so that the bottom section is missing from some of the images.

    1. Apologies, my second sentence above meant that using a different method I can get images loaded but they do not display properly. I can’t get images to display at all with the method described in the article above.

  6. Hi Chris,
    This topic of query optimization should be much more explored. Just a comparison with DAX show how much material there is for this language, from books to blog posts, while for M there is only a few sparsed sources, as your blog and some others for example.
    At least from my experience, M is as important as DAX, but many times I found it too slow to process even a small amount of data, reading a file multiple times for example. M should be the as fast and efficient as possible, but I don’t if this a implementation or end user fault.

    After this digression, what I would like to know is if the operation on lists, as in this post, is generally faster than operations on tables, and if this approach solves the multiple file readings problem.

    Thanks!

  7. I try it and work perfectly. But just one more question … does this work with the BI service on the cloud when it is refreshed

  8. hey Chris, is there a way to use binary image from a SQLdatabase instead of the actual image?

    1. My first reaction is to say no – this feature was actually removed from the product some time ago, I think because it was a security risk. However there might be a way around it… I would need to test some things first.

      1. Looked into it myself and it is possible it’s the same code just the source and the selected columns are different

    2. I was able to get this to work with binary images from my SQL db:

      let
      Source = Sql.Database(“server_name”, “database_name”),
      dbo_table = Source{[Schema=”dbo”,Item=”table”]}[Data],
      RemoveOtherColumns = Table.SelectColumns(dbo_table,{“image_id”, “binary_image”}),
      SplitTextFunction = Splitter.SplitTextByRepeatedLengths(30000),
      ListInput = Table.ToRows(RemoveOtherColumns),
      ConvertOneFile = (InputRow as list) =>
      let
      BinaryIn = InputRow{1},
      FileName = InputRow{0},
      BinaryText = Binary.ToText(BinaryIn, BinaryEncoding.Base64),
      SplitUpText = SplitTextFunction(BinaryText),
      AddFileName = List.Transform(SplitUpText, each {FileName,_})
      in
      AddFileName,
      ConvertAllFiles = List.Transform(ListInput, each ConvertOneFile(_)),
      CombineLists = List.Combine(ConvertAllFiles),
      ToTable = #table(type table[image_id=text,image=text],CombineLists),
      AddIndexColumn = Table.AddIndexColumn(ToTable, “Index”, 0, 1)
      in
      AddIndexColumn

      1. Hey XANDER,
        I almost got this working but I’m not familiar with M so I’m at my limit now. Would you be able to help me out for a fee?

  9. Hi Chris. First of all – thanks a lot for this post.
    I have a problem with using yours and Gerhard’s approaches to show images in cards. When I am using default “multi-row card” visual in power bi I see images as images when they are uploaded using public URL. However if I try to use your method and upload images from a local folder I will see a plain text instead of picture. Whereas in a “table” visual I see images as images in both cases. Any ideas what might be wrong with card visual?

  10. Hey Chris, thanks for this post.

    I want to make the image base64 results appear on one row.

    Would it be possible to convert the PIC columns to rows so that each image has a single row with multiple columns for base64 values and then make the DAX statement concatenate each column instead of each row?

    1. Why would you want to do this? The trouble with this approach would be that you would have an arbitrary number of columns to combine the data from, and that would be impossible to do in DAX; splitting the data across multiple rows is the only way to concatenate the text easily.

  11. Chris, master, you can give an example using connection to an sql database that is where I have my images to give me a more general idea of ​​how to interact.

    It will be a great help, a big hug and my usual respects.

      1. Hi Chris, any luck on this sample. I’m trying to do the same with a SQL data source

  12. Hi Chris, Can you guide me here. I have 1000 image folders for 1000 employees stored in drive, each folder having max of 6 images each. I have created a report in Powerbi and need to show images according to respective row of employees.
    is there any ideal approach to achieve this.

  13. Awesome post Chris,

    However, everything seems to check out and the table is populated with indexed strings but after creating the measure, enabling image url and inputting the image in CloudScope visual, nothing appears. Just an empty cell. First time working with M so maybe its a configuration thing but I added a second file and it was automatically sharded and indexed so im not sure what the issue is…

      1. Pulling the arrow to decrease the height wouldn’t scale the image, but I discovered decreasing the width will scale the image down. Also facepalm because in my initial comment I was using a PNG file. Thank you so much for this tutorial!

  14. Hi Chris,
    I’m getting an error on line 12 of your M Query “Token Literal is Expected” and the ampersand sign has a red squiggle under it. Any idea why?

  15. Brilliant Solution! I was able to get images up to 1Mb but I am facing a more advanced problem. How do we deal with multiple image files? I have 4 images in the same folder which would also need to be brought in.

    1. You can view the image you are interested in by simply utilizing a slicer. Each image will have a number of rows that divides the image up. But only the rows that are important (based on slicer selection – make sure only 1 selection can be made) will ‘remain,’ and the desired image will be displayed.

  16. Thanks so much for this Chris; does the code in the measure need to be changed in order to display different images, I’m only get one image to display?

  17. Yet another fantastic post. Thanks. I have a question that is triggered by this post but is only remotely related to it. Hope you don’t mind if I ask it anyway.
    I have a custom connector that reads data from an accounting system by wrapping a URL in OData.Feed. The custom connector handles the OAuth2 token exchange and everything works well. OData.Feed accepts “Concurrent = false” as option so I never get asynchronous requests messing up the OAuth2 tokens. Everything fine so far.
    Among other data, OData.Feed returns URLs to PDFs of invoices that I would like to process with the technique in your post (as I said: remotely related). The URLs look something like https://accountingsystem.com/Attachment.aspx?ID=e84549d8-f273-4704-8fb4-000b2e535d4a&Division=123456 and do not work if I wrap them in OData.Feed. Instead I am using Web.Contents() and process the result with your technique. It works for fetching a single PDF.
    However… There are some 30.000 PDFs, each with its own URL. I have not been able to get Web.Contents() to execute synchronously (there is no “Concurrent = false” option). As a result, things run async and the OAuth2 token dance doesn’t work anymore because there is another call before the refresh-token has been received.
    My question: Is there a way to do sychronous calls to Web.Contents() ?

    Any help or pointer is highly appreciated.

  18. I have implemented the solution using above concept it was working well till last week(30/04/2020) i am not sure what happened but suddenly it stopped working now, any idea or suggestion. All my image files are less than 400KB. Strange thing is same issue in my archived Dashboard as well. I am not updated my power BI Desktop and using December 2019 Version.

  19. Hey Chris, I just stumbled across this post and thought I’d share my approach to the same problem.

    See step #”Split Column by Position” below:

    let
    Source = Folder.Files(“C:\Users\snuss\OneDrive – Company\Desktop”),
    #”Added Custom” = Table.AddColumn(Source, “Text.Binary”, each “data:image/png;base64, ” & Binary.ToText([Content])),

    #”Split Column by Position” = Table.ExpandListColumn(Table.TransformColumns(#”Added Custom”, {{“Text.Binary”, Splitter.SplitTextByRepeatedLengths(32766), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), “Text.Binary”)

    in
    #”Split Column by Position”

    And the subsequent DAX:

    Pics_Aggregated =
    ADDCOLUMNS( SUMMARIZE( ‘Pics’, Pics[Name] ), “Full Binary”, CONCATENATEX( ‘Pics’, ‘Pics'[Text.Binary] ) )

  20. Hi Chris

    Thanks for the great post! Has helped me a lot! But what If the data I am connecting to already has base64 code in there? How would the code have to be adjusted?
    In my case I am connecting to a SharePoint list where I paste the base64 code into a field for each item. I can’t quite figure out how to tweak your code so that the base64 conversion is skipped and instead it just takes the existing column…. Thanks a lot for the help!

    1. The code should be a lot simpler, but without seeing your full query I can’t say for sure how. Please post this as a question to the Power BI forum and send me the link so I can take a look.

      1. Hi Chris

        I’ve managed to come up with a solution through the UI. The code now looks as follows:

        let
        Source = SharePoint.Tables(“URL”, [ApiVersion = 15]),
        #”34b325d6-e884-4159-98fe-eb9e9a39aac9″ = Source{[Id=”34b325d6-e884-4159-98fe-eb9e9a39aac9″]}[Items],
        #”Removed Other Columns” = Table.SelectColumns(#”34b325d6-e884-4159-98fe-eb9e9a39aac9″,{“Report Name”, “Base64 Thumbnail Ima”}),
        #”Split Column by Position” = Table.SplitColumn(#”Removed Other Columns”, “Base64 Thumbnail Ima”, Splitter.SplitTextByRepeatedLengths(30000), {“Base64 Thumbnail Ima.1”, “Base64 Thumbnail Ima.2”, “Base64 Thumbnail Ima.3”, “Base64 Thumbnail Ima.4”, “Base64 Thumbnail Ima.5”, “Base64 Thumbnail Ima.6”, “Base64 Thumbnail Ima.7″}),
        #”Changed Type” = Table.TransformColumnTypes(#”Split Column by Position”,{{“Base64 Thumbnail Ima.1”, type text}, {“Base64 Thumbnail Ima.2”, type text}, {“Base64 Thumbnail Ima.3”, type text}, {“Base64 Thumbnail Ima.4”, type text}, {“Base64 Thumbnail Ima.5”, type text}, {“Base64 Thumbnail Ima.6”, type text}, {“Base64 Thumbnail Ima.7″, type text}}),
        #”Unpivoted Columns” = Table.UnpivotOtherColumns(#”Changed Type”, {“Report Name”}, “Attribute”, “Value”)
        in
        #”Unpivoted Columns”

        I am guessing this is not that efficient, but it works for now. Any tricks on how to make this simpler?

      2. Hi Chris

        I managed to come up with a code through the UI and it looks as follows:

        let
        Source = SharePoint.Tables(“URL”, [ApiVersion = 15]),
        #”34b325d6-e884-4159-98fe-eb9e9a39aac9″ = Source{[Id=”34b325d6-e884-4159-98fe-eb9e9a39aac9″]}[Items],
        #”Removed Other Columns” = Table.SelectColumns(#”34b325d6-e884-4159-98fe-eb9e9a39aac9″,{“Report Name”, “Base64 Thumbnail Ima”}),
        #”Split Column by Position” = Table.SplitColumn(#”Removed Other Columns”, “Base64 Thumbnail Ima”, Splitter.SplitTextByRepeatedLengths(30000), {“Base64 Thumbnail Ima.1”, “Base64 Thumbnail Ima.2”, “Base64 Thumbnail Ima.3”, “Base64 Thumbnail Ima.4”, “Base64 Thumbnail Ima.5”, “Base64 Thumbnail Ima.6”, “Base64 Thumbnail Ima.7″}),
        #”Changed Type” = Table.TransformColumnTypes(#”Split Column by Position”,{{“Base64 Thumbnail Ima.1”, type text}, {“Base64 Thumbnail Ima.2”, type text}, {“Base64 Thumbnail Ima.3”, type text}, {“Base64 Thumbnail Ima.4”, type text}, {“Base64 Thumbnail Ima.5”, type text}, {“Base64 Thumbnail Ima.6”, type text}, {“Base64 Thumbnail Ima.7″, type text}}),
        #”Unpivoted Columns” = Table.UnpivotOtherColumns(#”Changed Type”, {“Report Name”}, “Attribute”, “Value”)
        in
        #”Unpivoted Columns”

        Not that efficient I guess? It works for now, but any hints how to make it more efficient?

  21. Hi Chris, I’m using a SQL Server to store the image file and path, how do I convert them into Base64 on the SQL Server directly? Also, when I connect the PowerBI to an OLAP (cube multidimensional), it doesn’t allows us to change the type of the column or create DAX measure. How do I set that column as IMAGE URL in SQL Server or Analysis Services instead in PowerBI? Really need your help, thanks!!

  22. Hi Chris,

    If I use the “table or matrix visual” to show the image it works!, but If I use a different custom visual it does not work. I tried the custom visuals “Simple Image”, “Clichet Slicer”, “Image Grid” and nothing. (besides that it looks image by cloudscape does not exist anymore =/ )

    Do you have ideas about what is happening?
    Do you think there is now a better way to show images in Power BI?

  23. This one is epic………… it really helped me a lot. A perfect workaround for images embedding

  24. Hey Chris,

    Like everyone else, thank you. I have it working nicely, however, I am stuck on how to set a “default” image when nothing in my report is selected/focused/sliced. Since there is no active “Name” to associate with until I click on a criteria, my image viewer defaults to a broken icon. Is there a way to set a default image or force a certain index of the image list to be shown when in default view?

  25. Hello Chris,

    is there a simple example to be downloaded for going though and analizing the solution? Thank you.

    1. Beacuse I was able to create the table, but the “Image URL” filed cannot be filled with a measure (the “Display Image” measure).

  26. The measure “Display Image” cannot be dropped into “Image URL” field of the “Simple Image” widget. Why?

  27. It worked well until the “Image by cloudscope” has been removed from PowerBI. Now, I cannot find an alternative. The “Simple Image” visual does not accept measures as an input, and putting the image into a table works (quite unexpectedly), but I cannot scale the size. In a table it is much to small.

      1. Can you please specify the alternative visuals for “Image by cloudscope” to display the image. “Simple image” visual is not accepting the measure as an input.

  28. Great workflow and description of the problem/solution. I’m just bummed they took away the visual with which it works. Having a hard time finding a workaround to point to local files.

  29. Hi, Chris. I’m attempting to do this with PDF files and I have been successful bringing in the initial table with the index column split into multiple rows. And the measure works perfectly; of course, though, there isn’t a PDF data category, and the PDF Viewer custom visual appears to require a column.

    So, I wonder if you have attempted to use CONCATENATEX to assemble the Base64 strings for each file into a calculated table with a row per file. I’m not certain in Simon’s response above whether that is what he was attempting to do, and as you indicated, it would result in multiple reads.

    Do you have an example of such an attempt? I’ll be trying to conjure the correct expression in the meantime. Thanks!

  30. Hi Chris! This works great for me! However, my images are displaying sideways. It looks like they need to be rotated 90 degrees clockwise and the source images are correct. Any suggestions?

  31. Hi! Amazing solution 🙂 I would like to know wich visual you used. I wasn’t able to find this icon in my PBI 🙁
    Thanks

  32. Hi Chris,
    That’s a lovely solution however, when I export it from service as ppt, Power BI fails export it as an image giving an error saying this feature is currently not available. Is there any workaround to get the base64 images into the original png image which is directly supported in the powerbi?

  33. Hello Chris,
    Thank you, it works like a charm. I’m using Power bi report builder with a power bi dataset but I’m not able to concatenate all the different fields in report builder like in your measure. Is there a simple way to do that ?
    Thank you for your help

  34. Hi Chris,
    Thank you for your knowledge and for sharing.
    What is the best way to get 15.000 images from SQL database, to show on powerbi service without unnecessary delays and automatic refresh problems (due to dynamic data sources).
    I tried the solution from your previous post, but the I had problem with the automatic refresh and with the speed.
    Do you have aby suggestion?
    Thank you

  35. Hi Chris,

    Thanks for the info. For me it is erroring at ‘ConvertAllFiles’

    Expression.Error: We cannot convert a value of type Table to type Binary.
    Details:
    Value=[Table]
    Type=[Type]

    Any tips on this?

  36. Great solution for pretty common problem, thank you Chris. For me works for pictures, but is not working for pdfs, which is what I really need. Both visuals from Cloudscope work fine for pictures (not pdfs :(), but Pdf viewer visual just does not accept measure. Any ideas why?

      1. I put 3 custom visuals – 2 from Cloudscope and pdf viewer (all from Microsoft Store).

  37. Hi Chris, thanks so much for this post. I am quite new at PowerBi and not so experienced in the datamodelling part, but following your steps, I was able to read a folder with images, get the bas64 table and display the images correctly using a slicer. My problem however, is that I am making report cards for schools in Cambodia in which they get a score and hints to improve on 4 indicators. Every indicator can have 4 values and there is an image with score and improvement tips for every value of the 4 indicators. So a reportcard consists of 4 images and every image is a possible of 1 out of 4. So I would like to automate this, instead of using a slicer. I have a construction, in which I read the indicator score and link that to a calculated column in my datafile with the filename. My problem is now how to link that column to the display_measure you have given in order to automatically display the right image. Do you have any suggestions? Thanks in advance

    1. Having a sample would help – can you share it (with dummy data)? I understand that you are trying to avoid using 4 slicers (correct me if I am wrong).
      It sounds like you can have 16 images that cover all combinations for 4 by 4 matrix – this way you need just one slicer.

  38. Dear Chris, Vlad

    Thanks so much for your quick reply and your willingness to look into the matter. I hope it will be only a small issue, but it is too complicated for me.

    A quick background: I am working on a project in which we support all about 9400 schools in Cambodia in improving their water, sanitation and hygiene situation. Better facilities lead to healthier kids and healthier kids skip less classes because they have fewer sick days etc. One of the ways to monitor progress is that the schools fill out a monitoring form every year with about 50 questions on their water, toilets etc. These questions are lumped into indicators on water, toilets, handwash facilities and environmental management. All of these indicators and the overall school performance are rated from 0 to 3 stars.

    As an incentive and recognition tool, the schools get a report card which shows their star levels and a certificate. On the report card it shows their star level per indicator and what needs to be done in order to grow in their performance. The report card looks like this and all graphic elements are images that are dynamically loaded depending on the indicator level.

    The idea is that at a provincial level or district, people from the Ministry of Education can generate and print out these report cards and discuss them with the schools. Based on the success we had in the Philippines, we decided to do this PowerBI. In the Philippines we could use powerBI to distribute the dashboard online, but sadly that does not work in Cambodia. So the idea is to do a pilot first where a selection of people will install the free version of PowerBi and we will share the data with them using USB. What I have understood is that internet is intermittent at best and they can not spend long times on line, so all data, including the images, need to be on the local computer.

    I have made a dashboard in which people can select the geographic area (province, district, village, commune) and then select the name of the school they are interested in and then the correct records are selected. This then generates the report card above and a second page which is the certificate.

    My workflow is as follows:
    I read an excel file with the monitoring data into PowerBI
    I created two subfolders one with support tables etc in excelformat and a second folder with all images
    Using the command, I add the columns to the data which contain the filename of the image to be shown column [ladder image]: with values like 00-star-ladder-khmer.png, 01-star-ladded-khmer.png etc.

    Using the code sample you showed in you blog, I read all the images and generated a base64 table with the images. File names in the column [Name] with values like 00-star-ladder-khmer.png, 01-star-ladded-khmer.png etc.

    So far so, good and using a slicer I can also display the images using this measure:
    Display Image =
    IF(
    HASONEVALUE(‘Base64 images'[Name]),
    “data:image/jpeg;base64, ” &
    CONCATENATEX(
    ‘Base64 images’,
    ‘Base64 images'[Pic],
    ,
    ‘Base64 images'[Index],
    ASC)
    )

    However in order to make this work automatically, I need to link up the calculated columns from my main table with the image filename in in the base64 table and then with a measure to display the image. Or, to make it match this example:

    How do I relate the contents of column [ladder_image] (00-star-ladder-khmer.png) in my main table to the [NAME] (00-star-ladder-khmer.png) in the Base 64 table and the use the measure to display the correct image. And then of course, repeat for the other indicators as well ..

    I hope that this makes thing clear and that it makes sense. Thanks in advance for your time and willingness and please do not hesitate to contact me if you would need more info.

    Ubo

  39. Hello Chris, thanks for this amazing content again! I was able to implement the M query successfully.

    However, I got an error when I dropped the ConcatenateX measure in the Image visual for a total string length of only ~73,000 characters:
    ” Memory error: While attempting to store a string, a string was found that was larger than the page size selected. The operation cannot be completed. ”

    I tried running my ConcatX measure with DAX Studio and I’m getting the exact same message. I have not found any useful information online about it. I ran a test modifying the measure to apply LEFT( [ConcatenateX], 30000) and it gets rids of the error, but of course, this truncates the image.

    Hope you can shed some light on this, thank you!

  40. Hi Chris
    I have tried the code provided in this post to view PDF files in the PDF Viewer. However the DAX output is blank

    Display Image =
    IF(
    HASONEVALUE(‘Test PDF Folder'[Name]),
    “data:image/jpeg;base64, ” &
    CONCATENATEX(
    ‘Test PDF Folder’,
    ‘Test PDF Folder'[Pic],
    ,
    ‘Test PDF Folder'[Index],
    ASC)
    )

  41. I am using similar approach for PNG images, but I have failed to show to image in any other visualization except as a miniature version in a table.
    Card, multi-row card, Chiclet Slicer 1.6.3, Image Grid, CloudScope 2.0.5 have all failed to display the image. Is it because of PNG format or do I have a defect somewhere?

    Meta data: “data:image/png;base64, “

  42. Hi Chris,

    I tried using this method but I’m getting an error ‘expression.syntaxerror: token literal expected’. I tried to identify some solutions around it but nothing seems to be helping. Will need some help from you. Could you please suggest what I should do with the above error.

  43. I guess this is neater solution:

    let
    BinaryToPbiImage = (BinaryContent as binary) as text=>
    let
    Base64 = “data:image/jpeg;base64, ” & Binary.ToText(BinaryContent,BinaryEncoding.Base64)
    in
    Base64
    in
    BinaryToPbiImage

    Just grab a folder of pictures, make a Fx in PQ, do a custom column Fx with Binary of pics as content, where you get base64 format of picture (binary). Use it everywhere in columns.

    1. This looks like it will work for small images, but the point of the post is how to work around the character limit on a text column so you can load larger images.

  44. Hello chris;
    First of all, thank you very much for this sharing. God bless your hands. It was a video that I used quite a lot and shared with my friends.
    But I am having a problem with 3rd one. Can you please help me?
    There is no problem until i write the formula in the query section.
    Normally ı have 20 rows of picture items. when i enter the code then it duplicates 11 of each picture. When I have 20 rows, it’s became 220 rows.
    Why does this problem occur?
    I guess there is a problem in the Combine list part.

  45. Hi Chris, I’m using this function for some of my projects, but I get the error below when I insert the measurement in the Image by CloudScope visual:

    *Memory Error: A string larger than the select page size was encountered while trying to store a string. Unable to complete the operation.*

    This doesn’t happen on all files, just some. My images have a size of 33Kb.

  46. Hi Chris, It works fine for images to a limited size (2.1 MB as mentioned in the post). I am trying to use a larger volume images which are over 200 MB. So is there any alternative method to use large size images.

  47. Chris, Thanks so much for putting this together. I’ve followed your directions however my visual, Image by CloudScope returns “The image ‘undefined’ could not be loaded.” There’s currently two version of Image by CloudScope, I’ve tried both and they both produce the same results. Any idea why I’m having this error? My images are .jpeg and are around 1.3-2.5MB. Appreciate any help you can provide.

  48. Hey Chris,

    Great post! Unfortunately, it’s not working for me and I suspect it’s because I don’t have the image visualization you selected in this step “and then display the value of the image in a report”. Any ideas on how I can import that into my local Power BI if I’m on version 2.123.742.0 64-bit (November 2023).

    Thank you!

Leave a Reply