Forum Discussion

HervePittet's avatar
HervePittet
New Member
1 year ago
Solved

Boutons dynamiques avec image

Bonjour, En fait, j'affiche des images dans une matrice de façon dynamique selon un paramètre. Dans ma table, j'ai les url des images et les url web. Je veux que l'image soit cliquable et dynamique ...
  • v-dineshya's avatar
    1 year ago

    Hi HervePittet ,

    Thank you for reaching out to the Microsoft Community Forum.

     

    Please follow below steps:

    1.Use a matrix with image URLs + web URLs as hyperlinks
    a. Ensure Your Data Table Has: ImageURL: A URL to a hosted image (e.g., PNG, JPG) and WebURL: The target URL you want to navigate to when the image is clicked.
    b. Convert Web URL to a Hyperlink Format: Add a new column or measure that returns [WebURL].

    c. Add Image to Matrix: In the matrix visual, Put some categorical field in Rows (e.g., Product, BU). Drag the ImageURL into Values. Set the data category of ImageURL to Image URL. Go to the Modeling tab > select the column > Data Category > Image URL.

    d. Make Image Clickable via Tooltip: Unfortunately, images themselves aren’t clickable, but you can:

    Option A: Use a custom column with an HTML link (in a Power BI custom visual like HTML Viewer): Create a column like

    ImageLink = "<a href='" & [WebURL] & "' target='_blank'><img src='" & [ImageURL] & "' width='100'></a>"

    Use a custom visual like HTML Content Viewer from AppSource.

    Option B: Use a Button + Tooltip: You can't "energize" buttons dynamically in a matrix, but you can Use buttons with dynamic tooltips. Use bookmarks or field parameters to change visuals based on interaction (but not open external URLs dynamically).

    Option C: Use Card Visuals Dynamically: If you can restructure your report slightly, you can use card visuals bound to a dynamic measure, then make them act like buttons (with WebURL as the action).

    Note: Power BI matrix images are not clickable directly. Buttons cannot dynamically change their URL action (no dynamic hyperlink action yet).

    Workarounds often involve: Using HTML Viewer custom visual. Using dynamic tooltip visuals. Embedding images as HTML.

    2. Use Power BI Custom Visuals: HTML Viewer (by CloudScope): Accepts HTML, allows clickable images. Deneb (if you're familiar with Vega-Lite): Build custom visuals with links.

    3. Using Base64 Encoding: You can transfer the image to Base64 code and use it as an image URL to insert into a table. This allows you to use a slicer to filter the images dynamically. You can use websites like https://base64-image.de to convert your images to Base64 code. Then, copy the code to a table and set the column type to Image URL.

     

    please refer community thread
    https://community.fabric.microsoft.com/t5/Desktop/Dynamic-Images-based-on-Slicer-selection/td-p/3170912

     

    If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.

     

    Thank you