<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/interactive-sunburst-graphs-in-power-bi-in-5-minutes/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://longhowlam.wordpress.com/2017/07/13/interactive-sunburst-graphs-in-power-bi-in-5-minutes/"> R – Longhow Lam's Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><img data-orig-file="https://longhowlam.files.wordpress.com/2017/07/pbiviztool.png?w=456" data-orig-size="787,529" data-medium-file="https://longhowlam.files.wordpress.com/2017/07/pbiviztool.png?w=456?w=300" data-attachment-id="2242" data-image-meta="{" data-image-description="" src="https://longhowlam.files.wordpress.com/2017/07/pbiviztool.png?w=456" data-permalink="https://longhowlam.wordpress.com/2017/07/13/interactive-sunburst-graphs-in-power-bi-in-5-minutes/pbiviztool/" data-large-file="https://longhowlam.files.wordpress.com/2017/07/pbiviztool.png?w=456?w=440" alt="pbiviztool" data-image-title="pbiviztool" sizes="(max-width: 440px) 100vw, 440px" data-comments-opened="1" class="wp-image-2242" data-recalc-dims="1"></p>
<h2>Introduction</h2>
<p>If I mention Power BI to fellow data scientists I often get <strong>strange looks</strong>. However, I quite like the tool, it is an <strong>easy and fast</strong> way to share results, KPI’s and graphs with others. With the latest release, Power BI now supports interactive R graphs, and they are easy to create as well.</p>
<h2>Steps to follow</h2>
<p><strong>1.</strong> Install Node.JS from <a rel="nofollow" href="http://npm%20install%20-g%20powerbi-visuals-tools/" target="_blank">here </a>and then you can install the power bi tools with:</p>
<pre>><span>npm</span> install -g powerbi-visuals-tools
</pre>
<p><strong>2.</strong> Create a new custom R visual:</p>
<pre>>pbiviz <span>new</span> sunburstRHTMLVisual -t rhtml
</pre>
<p><strong>3.</strong> This will create a directory <strong>sunburstRHTMLVisual. </strong>In that directory, edit the R script file <strong>script.r</strong>. It’s a one-liner to create a sunburst graph with the sunburstR package.</p>
<div><img src="https://i1.wp.com/media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAzyAAAAJGU5NThmZmQzLTZjZDgtNDc4MC04MTZiLTBmNWU4YWE2YzVkMQ.png?w=456&ssl=1" data-recalc-dims="1"></div>
<p> </p>
<p><strong>Values </strong>is the name of the input data frame, the data that is received from within the Power BI desktop application.</p>
<p><strong>4.</strong> Now create the custom R visual as package with the following command: (issue this command inside the directory sunburstRHTMLVisual)</p>
<pre>>pbiviz <span>package</span>
</pre>
<p><strong>5.</strong> Inside the sub folder <strong>dist</strong> you will now find the file <strong>sunburstRHTMLVisual.pbiviz</strong>, this can be used in Power BI. Open the Power BI desktop application and import a custom visual from file. Select the sunburstRHTMLVisual.pbiviz file</p>
<div><img src="https://i0.wp.com/media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAtKAAAAJDNlNTM2ZTE2LTUxNTQtNDg3YS1hMTVmLWE4ZGI0Yjk0OWI3YQ.png?w=456&ssl=1" data-recalc-dims="1"></div>
<p> </p>
<p><strong>That’s it, you’re done!</strong></p>
<h2>The resulting graph in a dashboard</h2>
<p>To use the visual you will need a data set in power bi with two columns, one with the sequences and one with the number of occurrences of the corresponding sequence.</p>
<div><img src="https://i2.wp.com/media.licdn.com/mpr/mpr/AAEAAQAAAAAAAAyxAAAAJGQ0MGI4YTgwLWJjMWYtNGQyNy1iNTNkLTdkNGYxMjc0MzFkZQ.png?w=456&ssl=1" data-recalc-dims="1"></div>
<p> </p>
<p>Click on the icon of the custom R visual you’ve just imported and select the two columns to get the interactive sunburst graph. Once the graph is created, you can hover over the rings to get more info, and you can turn on/off the legend.</p>
<div><img src="https://i0.wp.com/media.licdn.com/mpr/mpr/AAEAAQAAAAAAAA2fAAAAJDFjZGZkZjY2LTg3ZDMtNDIzMy1iYjkxLTVjMzgwYzBlZDVlOA.png?w=456&ssl=1" data-recalc-dims="1"></div>
<p> </p>
<p><strong>Cheers, Longhow.</strong></p>
<p> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/longhowlam.wordpress.com/2241/" target="_blank"><img border="0" alt="" src="http://feeds.wordpress.com/1.0/comments/longhowlam.wordpress.com/2241/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://longhowlam.wordpress.com/2017/07/13/interactive-sunburst-graphs-in-power-bi-in-5-minutes/"> R – Longhow Lam's Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/lQ4ToGljM98" height="1"></a></div>