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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Kafui
New Member

Displaying Base64 Image in PBI desktop

I am using Power Bi preimum. The report is a composite model. For fetching the base64 images from a SQL table  it uses a direct query. Some of these strings are over the 32k characters limit that Power Bi can handle(they go up between 40-45k characters).

 

Since it is a direct query Chris Webb's solution didnt work for me, as it would only work data that had been imported into PBI.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@Kafui 

Regarding the issue you raised, my solution is as follows:
 1.You can try using the following functions to convert the data into smaller data:

(Input) =>
let
// Debug function
// Source = LongTable,
   Source = Input,
   JSON = Json.FromValue(Source),
   Compress = Binary.Compress(JSON, Compression.Deflate),
   ToText = Binary.ToText(Compress),
   TextLength = Text.Length(ToText),
   ChunkUp = {0..Number.RoundUp(TextLength/30000)-1},
   ConvertToTable = Table.FromList(ChunkUp, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
   StartPosition = Table.AddColumn(ConvertToTable, "Start", each [Column1]*30000),
   Elements = Table.AddColumn(StartPosition , "Custom", each Text.Range(ToText , [Column1]*30000, List.Min({TextLength-[Column1]*30000,30000})))
in
   Elements 

2.Then use this function to recover the data:

let
    Source = (LinkbackTable) =>
let
// Debug function
// LinkbackTable= LinkbackTable,
    Source = Excel.CurrentWorkbook(){[Name=LinkbackTable]}[Content],
    CombineText = Text.Combine(Source[Custom], ""),
    ConvertToBinary = Binary.FromText(CombineText),
    CompressBinary = Binary.Decompress(ConvertToBinary, Compression.Deflate),
    OpenJSON = Json.Document(CompressBinary),
    ConvertToTable = Table.FromList(OpenJSON, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    ExpandAllColumns = Table.ExpandRecordColumn(ConvertToTable, "Column1", Record.FieldNames(ConvertToTable[Column1]{0}), Record.FieldNames(ConvertToTable[Column1]{0}))
in
    ExpandAllColumns
in
    Source

3.Here are the links to the relevant documents I found to help you:

Solved: About the character limit when loading a query int... - Microsoft Fabric Community

Chris Webb's BI Blog: Storing Large Images In Power BI Datasets (crossjoin.co.uk)

How to store tables longer than 1,1 Mio rows in an Excel-sheet using Power Query and JSON – (thebicc...

Solved: Re: Image Visualisation not showing the full pictu... - Microsoft Fabric Community

 

If you have any other findings, you are welcome to share them with us.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi,@Kafui 

Regarding the issue you raised, my solution is as follows:
 1.You can try using the following functions to convert the data into smaller data:

(Input) =>
let
// Debug function
// Source = LongTable,
   Source = Input,
   JSON = Json.FromValue(Source),
   Compress = Binary.Compress(JSON, Compression.Deflate),
   ToText = Binary.ToText(Compress),
   TextLength = Text.Length(ToText),
   ChunkUp = {0..Number.RoundUp(TextLength/30000)-1},
   ConvertToTable = Table.FromList(ChunkUp, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
   StartPosition = Table.AddColumn(ConvertToTable, "Start", each [Column1]*30000),
   Elements = Table.AddColumn(StartPosition , "Custom", each Text.Range(ToText , [Column1]*30000, List.Min({TextLength-[Column1]*30000,30000})))
in
   Elements 

2.Then use this function to recover the data:

let
    Source = (LinkbackTable) =>
let
// Debug function
// LinkbackTable= LinkbackTable,
    Source = Excel.CurrentWorkbook(){[Name=LinkbackTable]}[Content],
    CombineText = Text.Combine(Source[Custom], ""),
    ConvertToBinary = Binary.FromText(CombineText),
    CompressBinary = Binary.Decompress(ConvertToBinary, Compression.Deflate),
    OpenJSON = Json.Document(CompressBinary),
    ConvertToTable = Table.FromList(OpenJSON, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    ExpandAllColumns = Table.ExpandRecordColumn(ConvertToTable, "Column1", Record.FieldNames(ConvertToTable[Column1]{0}), Record.FieldNames(ConvertToTable[Column1]{0}))
in
    ExpandAllColumns
in
    Source

3.Here are the links to the relevant documents I found to help you:

Solved: About the character limit when loading a query int... - Microsoft Fabric Community

Chris Webb's BI Blog: Storing Large Images In Power BI Datasets (crossjoin.co.uk)

How to store tables longer than 1,1 Mio rows in an Excel-sheet using Power Query and JSON – (thebicc...

Solved: Re: Image Visualisation not showing the full pictu... - Microsoft Fabric Community

 

If you have any other findings, you are welcome to share them with us.

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors