Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

barritown

Experimental Custom Pie Chart in Power BI

Preamble

 

From time to time I challenge myself to imitate creative vizualizations I stumble upon on the vast expanse of Internet using only standard visuals in Power BI. So this article is all about one of those challenges.

 

Having found the chart below, I started thinking how one can create a pie chart where slices differ not only by sector width but by its length as well, if it is allowed to put it like that.

 

Source of inspirationSource of inspiration

And I did find a way. 

 

Final ResultFinal Result

Warning

 

All in all, it is something more like a study rather than a recipe for production usage so think twice before applying this solution to your dashboards.

 

Pie Chart Colored by Measure

 

We will start from such a simple pie chart.

 

Simple pie chart with a small secretSimple pie chart with a small secret

Though it is simple it has a secret behind.

 

And this secret is hidden in the way the pie chart is colored. If you suppose that all those gradient shades were handpicked by me in the standard pie chart menu, you will be wrong, because in fact all the slices colors are defined by a measure. This one:

 

Color scheme measureColor scheme measure

But you won't find an option to apply a measure in the pie chart settings, will you?

 

No place for measuresNo place for measures

 

No, really, you won't, but such an option exists in the bar chart settings.

 

Existing option for bar chartsExisting option for bar charts

 

All you need to do is to add a bar chart, color it properly with a measure and then switch the visual type to a pie chart. The settings will be inherited somehow and the segment colors will be defined by the measure.

 

Multiple Pie Charts

 

You should count the maximum possible number of slices on your pie chart and clone the pie chart as many times. Before cloning, mind to change transparency of the pie chart background to 100%.

 

For each additional pie chart you should prepare a color scheme measure similar to the original one with a small difference: the last 1, 2, 3, .., n-1 segments must have the color of the canvas background, where n is the maximum possible number of segments.

 

Here comes one more ruse to trick the system: if you use the same color for two adjacent segments, Power BI will split them by drawing a line between them. If you want to get rid of it, you should apply a different color for one of the segments, which differs by so little that a rare human eye will spot difference.

 

If you see that the last two sectors of the pie chart are differently colored, I envy your vision.If you see that the last two sectors of the pie chart are differently colored, I envy your vision.

 

After that you adjust the size of all the pie charts: the smallest one should be one with the captions, the next one with one "missing" sector should be a little bigger, the next one - a little bit bigger than the second and so on - the one with the only green sector should be the biggest.

 

Then you select all of them and center by both axis.

 

Align center + Align middleAlign center + Align middle

 

Once done, you group them. At the bottom you can add a visual with the title and legend to make it look better.

 

 

That's it. Hope you will find this study and tricks I shared with you useful.

 

If you want, you can:

- download the PBIX file;

- watch YouTube video in English;

- watch YouTube video in Russian;

- read this article in Russian.