Grouping datasets into overlapping circles can, in many cases, allow your audience to easily grasp relationships between them. Power BI comes a bit short in being able to deliver on this, with no out-of-the-box visualisations for Venn or Euler graphs – and the custom visualisations are lacking essential features or cost up to US$5,000 p/annum.
Then I found the eulerr library – not something for beginners, but able to generate reasonably accurate Venns and Eulers, including having the circles resize depending on the size of the data set.
Building your own Euler diagram in Power BI
- If you haven’t already, install RStudio, the integrated development environment for R with hundreds of visualisation libraries, including eulerr
- Provide a number for each segment. For three groups in a diagram, I created measures for defining the following fourteen numbers (there’s bound to be an easier way! Let me know in the comments):
- People in any of the three sets:
All=DISTINCTCOUNT(A+B+C)
- People in two sets:
AandB=COUNT(A+B)-DISTINCTCOUNT(A+B
)
- People in one set but not another:
AnotB=A-AandB
- People only in one set – the outer segments:
Aonly=All-(BandC+BnotC+CnotB)
- People in two sets but not the other – the three inner segments:
AandBnotC=(AnotC)-(Aonly)
- People in all three – the central intersection/segment:
ABCintersect=All-(Aonly+Bonly+Conly+ AandBnotC+AandCnotB+BandCnotA)
- People in any of the three sets:
- Add an R visualisation into your report page
- Drag the measures you defined in points 4-6 above into the visualisation
- Code and run the visualisation using something like:
library(eulerr)
myeuler <- euler(c(
"A" = dataset$Aonly, "B" = dataset$Bonly, "C" = dataset$Conly,
"A&B" = dataset$AandBnotC, "A&C" = dataset$AandCnotB, "B&C" = dataset$BandCnotA,
"A&B&C" = dataset$ABCintersect))
plot(myeuler, labels = list(labels = c("Forum\nsubscribers", "Network\nmembers", "Followers"),fills = c("#B7D9B5", "#4BA046", "#E61E28")
)
Handy feature is the \n in the ‘labels’ code, which forces a new line.
Additional guidance on configuring this R visual by Johan Larsson is available at the following locations:
If you want to double-check your numbers, you could add the free-to-use Ultimate Venn Diagram custom visualisation; which is a dead easy option until you start wanting to add colours to your sets or using a Euler rather than Venn, at which point you’ll need to either pay for a license, or suffer your users to endure the watermark. Fair play to the developer there!
One reply on “Power BI : Learn to build free Venn and Euler diagrams”
That’s so cool and useful. Thank you.