# Handling long Base 64 URLs in Power BI

If the images are displaying partially in Power BI with the Base 64 URLs, then the reason is the character limit in Power BI. The maximum length of a text value that the Power Query engine can load into a single cell in a table in a dataset is 32,766 characters – any more than that and the text will be silently truncated.

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FvtNsysyffzz39132Yfsn%2Fimage.png?alt=media&#x26;token=f6a070de-97cb-48fe-ac2e-6e24acb665c1" alt="" width="563"><figcaption><p>Image 1: Images displaying partially in Power BI</p></figcaption></figure>

## Check the length of characters of the Base64 URL in Transform Editor/Power Query

To understand what the length of the Base 64 URLs for your images is, please follow the below steps:

1. Select the Base 64 column of the image
2. Add column → Extract → Length

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2Fx62cLxbcUi9CeXiXgSs7%2Fimage.png?alt=media&#x26;token=89309fc1-3181-4735-9619-5794f1c9b789" alt="" width="545"><figcaption><p>Image 2: Extracting the length of every value for a column in Power Query</p></figcaption></figure>

3. You will now be able to see the length of the Characters of all the Base64 URLs

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FpcDoLqQhvZVRD7hDjQfs%2Fimage.png?alt=media&#x26;token=95e2d924-53a3-40f8-8d55-c6f45c2070c7" alt="" width="563"><figcaption><p>Image 3: Length of Base 64 URLs in Power Query</p></figcaption></figure>

## Steps to handle long Base 64 URLs to display the full images

### Step 1: Data Type of the Base 64 URL column

Ensure that the data type of the Base 64 URL column must be "Text"

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FrTOtzDsYS3fjE1wQGx3H%2Fimage.png?alt=media&#x26;token=e495f162-7395-4c80-8b89-87c0199001a2" alt=""><figcaption><p>Image 4: Data type as Text</p></figcaption></figure>

### Step 2: Transformation steps in Advanced Editor

Open the Advanced Editor of the same query for the next set of steps:

1. Click on Advanced Editor

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FYDgedwKosNdCack57Zt6%2Fimage.png?alt=media&#x26;token=c04e660b-5d7c-4512-ad07-561459afae68" alt="" width="563"><figcaption><p>Image 5: Advanced Editor option in Power Query</p></figcaption></figure>

4. Copy and paste the below code in the existing steps:

<pre class="language-powerquery"><code class="lang-powerquery">   // Creates Splitter function
   #"SplitTextFunction" = Splitter.SplitTextByRepeatedLengths(30000),
   // Converts table to list
   #"Input List" = Table.ToRows(LastStepName),
   //Function to convert binary images to multiple text values
   #"Convert 1 File" = (InputRow as list) =>
     let
        BinaryIn = InputRow{1},
        FileName = InputRow{0},
        BinaryText = Binary.ToText(BinaryIn, BinaryEncoding.Base64),
        SplitUpText = SplitTextFunction(InputRow{1}),
        AddFileName = List.Transform(SplitUpText, each {FileName,_})
     in
        AddFileName,
   // Loops over all images and calls the above function
<strong>   #"Convert All File" = List.Transform(#"Input List", each #"Convert 1 File"(_)),
</strong>   // Combines lists together
   #"Combine the Lists" = List.Combine(#"Convert All File"),
   // Converts results to table
   #"Convert to Table" = #table(type table[Name=text,Base64 Img=text],#"Combine the Lists"),
   // Adds index column to output table 
   #"Added Index" = Table.AddIndexColumn(#"Convert to Table", "Index", 1, 1, Int64.Type)
in
    #"Added Index"

</code></pre>

Note: Ensure to replace *LastStepName* with the name of the last step that you see in the Advanced Editor before pasting this code

The final query should look something like as shown below:

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2F2GfpUNOKHVU6P8pkS2rk%2Fimage.png?alt=media&#x26;token=f257273c-5ff8-4470-beab-d6b07b9fb614" alt=""><figcaption><p>Image 6: Final query look</p></figcaption></figure>

### Step 3: Creating a DAX measure to group the Base64 URL to display the images

1. Create the below DAX measure to display the images

```dax
Display Image = 
   CONCATENATEX(
        'Base64', 
        Base64[Base64 Img],
        , 
        Base64[Index],
        ASC)
```

2. Add the DAX measure in the Performance Flow visual and display the images

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FBmNEmciVt7qPsbqJ51g6%2Fimage.png?alt=media&#x26;token=6fb661f7-8882-4162-93d7-9e5642092caf" alt="" width="563"><figcaption><p>Image 7:High-resolution Images in xViz Performance Flow visual</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xviz.com/performance-management/display-data-in-the-cards/images/handling-long-base-64-urls-in-power-bi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
