Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Problem with dynamic local images

Hi all,

 

I am working on data from schools displaying a report card depending on the score a school has for a specific topic. A design option has been to have the score cards made by a graphic designer and implement these in a powerBi report.So for instance, if a school scores 1 on topic A, then the image to be displayed would be topic_image_01.png,; if it scores 2, it would be topic_image_02.png etc. I have five topics, so every report consists of 5 images and some supporting text (which also may differ for the different scores)

 

 That worked all fine when I was able to load the images from the web. However, due to internet connectivity issues in the country of the data, I need to have the images online and that proves more difficult. 

 

Using some webposts and forum info I was able to:

1 covert the data into BASE64 format and store them in a local table  on my database using the method mentioned here: https://blog.crossjoin.co.uk/2019/05/19/storing-large-images-in-power-bi-datasets/

2 I can now display the data using a slicer, so all works well, the measure used to display the data is:

 

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

 

but .. I would like to automate things more and would like to display the image automatically in the report card. The idea is that I select a school and then read from the table what the scores are for the different topics. These scores, I need to link one way or another to the images so that I can display them automatically. Any suggestions? 

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous,

    You can store your image files in SharePoint or a local folder, then you can get data from that folder and convert them to binary and base64 strings for image URL analysis. These contents can be dynamic changes when you update the source files.

    Regards,

    Xiaoxin Sheng

    • Anonymous's avatar
      Anonymous
      Not applicable

      Dear Xiaoxin Sheng,

       

      Thanks for the reply and the suggestion, but that actually covers the part that I have working. My problem is in eliminating the slicer and have placement of the images  Let my try to explain more clearly:

       

      I have data of more than a 1000 schools with amongst many other data, has 4 columns with indicators I am interested in. Each column can have a value of 0,  1, 2 or 3 stars.  So for instance School  X scores 1 star at indicator 1 and 3 at indicator 2 etc. Each indicator score links to an image I want to publish at the score card. That means for each indicator, I also have 4 possible images (linked to a score of 0, 1, 2, 3)

      So:

      School X may score 1 at indicator 1 which means I have to use the image  #indicator1-img1.png

      School Y may score 3 at indicator 1 which then means I have to use image: #indicator1-img3.png

       

      All images have been stored in one in one folder and have been converted to base64 and I can use the script from my first post to display them if I use a slicer. However, with > 1000 schools and 4 indicators, I do not want to use a slicer,  but I want to this automatically...

       

      What I did before I learned that the data would need to be local was the following: I created a calculated column for each indicator and based on the score, I would add the correct the picture URL  using a related table. Then I would use the value in the column to display the image.

       

      Sadly enough that does not work with local data and the base64 format, so I need an alternative option. Does anyone have ideas?

       

      Thanks, Ubo