> For the complete documentation index, see [llms.txt](https://docs.xviz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xviz.com/performance-management/display-data-in-the-cards/images/converting-https-link-images-icons-to-base-64-in-power-bi.md).

# Converting HTTPs link images/icons to Base 64 in Power BI

If you have a column of images/icons in https links format like below:

<figure><img src="/files/pD8RnEiq4etmgwts9f4B" alt="" width="230"><figcaption><p>Image 1: Column of https links for images/icons</p></figcaption></figure>

Then you can convert it to base 64 URL format, which is the acceptable format by the xViz Performance Flow visual (as it is certified):

<figure><img src="/files/TgHgHGa8I3syGIh1hOYA" alt="" width="325"><figcaption><p>Image 2: Columns of Base 64 URLs for images/icons</p></figcaption></figure>

### Steps to be followed in Transform Editor/Power Query:

#### Step 1: Create a Custom Function in your Power BI report -> Transform Data:

1. Home → New Source → Blank Query<br>

<figure><img src="/files/py470lwsOc6hAd0k37Yg" alt="" width="190"><figcaption><p>Image 3: Create a New Blank Query</p></figcaption></figure>

2. Change the name of the query to Query1 to *ImgtoBase64Url* and Click on Advanced Editor

<figure><img src="/files/HlprOOZENc18n2SfjtF4" alt="" width="563"><figcaption><p>Image 4: Advanced Editor option</p></figcaption></figure>

3. Paste the below code and Click on Done:

```powerquery
let
    Source = (ImageUrl as text) as text =>
let
    BinaryContent = Web.Contents(ImageUrl),
    Base64 = "data:image/jpeg;base64, " & Binary.ToText(BinaryContent, BinaryEncoding.Base64)
in
    Base64
in
    Source
```

**Note:** The prefix of "data:image/jpeg;base64, " must be adjusted as per the image extension, i.e. replace the "jpeg" with the extension of the image that you are using (eg: png, etc.)

#### Step 2: Invoke the custom function in the data:

1. Add Column → Invoke Custom Function

<figure><img src="/files/r839jsBtKdwdSOfUjUSj" alt="" width="367"><figcaption><p>Image 5: Invoke Custom Function option</p></figcaption></figure>

2. Add the following details in the popup:
   1. Provide a name for the new column
   2. Select the function query name “*ImgtoBase64Url*”
   3. Select the column with Images URL

<figure><img src="/files/5VyP4o9UPwpo974JWZ02" alt=""><figcaption><p>Figure 2: Invoke Custom Function dialog box</p></figcaption></figure>

**Result:** This will result in a new column named "Image" which will contain the Base 64 URLs. Use this column in the xViz Performance Flow visual.&#x20;

Here is an **example** report file:&#x20;

{% file src="/files/sqhytKhGyr0BAoR5N7wR" %}

{% hint style="info" %}
If the images you are referring are of high resolution which results in over 33,000 characters in base 64 format, then you might see only partial image rendering because of the character limit in Power BI. Check out this page for the solution - [Handling long Base 64 URLs in Power BI](/performance-management/display-data-in-the-cards/images/handling-long-base-64-urls-in-power-bi.md)
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.xviz.com/performance-management/display-data-in-the-cards/images/converting-https-link-images-icons-to-base-64-in-power-bi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
