Interactive sunbuRst graphs in Power BI in 5 minutes!!

pbiviztool

Introduction

If I mention Power BI to fellow data scientists I often get strange looks. However, I quite like the tool, it is an easy and fast 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.

Steps to follow

1. Install Node.JS from here and then you can install the power bi tools with:

>npm install -g powerbi-visuals-tools

2. Create a new custom R visual:

>pbiviz new sunburstRHTMLVisual -t rhtml

3. This will create a directory sunburstRHTMLVisual. In that directory, edit the R script file script.r. It’s a one-liner to create a sunburst graph with the sunburstR package.

 

Values is the name of the input data frame, the data that is received from within the Power BI desktop application.

4. Now create the custom R visual as package with the following command: (issue this command inside the directory sunburstRHTMLVisual)

>pbiviz package

5. Inside the sub folder dist you will now find the file sunburstRHTMLVisual.pbiviz, 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

 

That’s it, you’re done!

The resulting graph in a dashboard

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.

 

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.

 

Cheers, Longhow.

Advertisements

8 thoughts on “Interactive sunbuRst graphs in Power BI in 5 minutes!!

  1. Pingback: Interactive sunbuRst graphs in Power BI in 5 minutes!! – Mubashir Qasim

  2. Hey Longhow, I love your blog here. Do you mind if I share it across my network? Also, I would like to post it at the pbiusergroup.com/datascience Virtual Group, from PowerBI for Data Science community, with your permission. Of course, you are more than welcome to join the Virtual Group. Thank you

    Like

  3. Mehr, couldn’t get to work. You hyperlinked location from which to dload node.js is also a dead link. Followed exactly, the custom visual is available in PowerBI, but just get enormous error msg:-
    Error Message:
    R script error.
    Loading required package: XML
    Warning messages:
    1: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
    there is no package called ‘XML’

    Like

  4. Sorry, couldn’t get to work. This error send for me.

    C:\Users\gigar>pbiviz package
    error LOAD ERROR Error: pbiviz.json not found. You must be in the root of a visual project to run this command.
    at e (C:\Users\gigar\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\lib\VisualPackage.js:70:35)
    at Function.loadVisualPackage (C:\Users\gigar\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\lib\VisualPackage.js:65:16)
    at Object. (C:\Users\gigar\AppData\Roaming\npm\node_modules\powerbi-visuals-tools\bin\pbiviz-package.js:49:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)

    C:\Users\gigar>

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s