Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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:
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?
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
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
HI @Anonymous,
It sounds like you are processing a huge amount of records. Initiations and processing with lots of images should affect the performance of the report.
Optimization guide for Power BI - Power BI | Microsoft Docs
For this scenario, I'd like to suggest you use 'Unicode characters' instead. They not used too many system resources and they can reduce the performance loss when used on your report.
Using Unicode Characters in Power BI (biinsight.com)
Regards,
Xiaoxin Sheng
Thanks for the reply. It is not that many pictures, 4 indicators, 4 potential values so all in all a choce of 16 images, Of which only 4 will be used in the report card. The fact that I have many schools makes it a bit complicated. Sadly the images are quite beautiful and big, so unicode does not work
HI @Anonymous,
Sure, you can try to use the switch function and if statement to concatenate the 'image name' string and use it to lookup image table based on your selections:
Display Image =
VAR _indicator =
SELECTEDVALUE ( Selector[indicator] )
VAR result =
SWITCH (
SELECTEDVALUE ( Selector[rate] ),
1, 'image1',
2, 'image2',
3, 'image3',
4, 'image4',
5, 'image5',
'imageDefault'
)
RETURN
IF (
result <> BLANK (),
"data:image/jpeg;base64, "
& LOOKUPVALUE ( Table[pic], Table[Name], _indicator & "-" & result )
)
Regards,
Xiaoxin Sheng
Thank you so much! this looks like what I need. I do not have time today, but will check on Monday and let you know the results!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |