In a super cool trick for Power BI, Miguel Myers (@myersmiguel) did an overlay between a bar chart and a duplicated image to simulate a proportional fill, resulting in this:
You can see the full report here. While he shows how to do it in a YouTube video, it took me a while to simulate it and I thought it would be nice to write it up.
To start, you will need an image to work with. This is my initial image:
Now make the outside of the silhoutte the same color as the background of your report. In my case, it’s already white so I didn’t have to do anything (in Mykhael’s report, it is black).
Next, make the shape transparent:
And then duplicate it as many times as the maximum for your measure, as in:
For example, for a measure that’s a percentage, you may want to have 10 shapes so that each represents 10%.
Now to the report. Create a bar chart and remove the X axis and the title:
Bring in your image over it and immediately you will start seeing the end result:
Adjust the heights of the bar and of the image so that the bar is fully covered:
Then left-align the image to the start of the bar
So that the bar does not stretch past the image, you will need to make sure that the image is exactly and completely filled at the max value of the measure. This will also take care of displaying the right amount of fill for the different values of the measure.
Another key point is to set the start and end values of the axis so that they don’t change with different filter selections in your report and then wreak havok on the proportions you just coordinated.
This is the final product:
Leave a Reply