Introduction
This week’s challenge is a little SVG fun. Recent Power BI Desktop changes have allowed even further width and height adjustments for images in matrix visuals. So we will be extending this by making a bar chart of chocolate bars.
Requirements
Power Query
- Obtain the dataset from 2023-week-11 challenge or;
- Obtain the dataset from https://www.kaggle.com/datasets/rtatman/chocolate-bar-ratings
- Model and load data
Power BI Desktop
Option 1:
- Obtain or draw an image of a chocolate bar
- With PowerPoint or your tool of choice, overlay a rectangle shape of the same size
- Select all shapes and save as SVG
- Open SVG in notepad, studio code, or browser
- Modify the size of images and overlaid rectangle to be the same size
- Ensure the overlaid rectangle is the same colour as your report background
- Create a DAX measure that adjusts the size of the overlaid rectangle according to a variable of your choice
- Ensure measure category is set to Image URL
- Place the measure in a matrix
- Switch values to rows
- Adjust image width and height
Alternative:
- To learn more on SVG clip path: https://hatfullofdata.blog/svg-in-power-bi-part-3/ and https://www.sarasoueidan.com/blog/css-svg-clipping/
- Obtain or draw an image of a chocolate bar
- Obtain the SVG path or convert a PNG to Base64 https://www.base64-image.de/
- Utilise clip path to fill the bars according to a variable of your choice
Dataset
The dataset this week can be viewed https://www.kaggle.com/datasets/evangower/chocolate-bar-ratings
or file downloaded
Workout Wednesday #WoW2023 | Week 11 : LINEST Reg… – Microsoft Power BI Community
Share
After you finish your workout, share on Twitter using the hashtags #WOW2023 and #PowerBI, and tag @MMarie, @shan_gsd, @KerryKolosko. Also make sure to fill out the Submission Tracker so that we can count you as a participant this week in order to track our participation throughout the year.
Solution
Solution File available for download via Data Stories Gallery