Power BI In Jupyter Notebook

Swapnil Bandgar
Nerd For Tech
Published in
3 min readMay 29, 2021

Recently Microsoft announced the Power BI integration with Jupyter, Now we can tell data stories using Jupyter notebook.

As Microsoft launching new powerbiclient package we can export and embed Power BI reports, dashboards, dashboard tiles, report visuals or Q&A in Jupyter notebooks easily.

Power BI is a set of software services, apps, and connectors that work together to transform data from different data sources into logical, visually immersive, and interactive insights.

Our data could be in the form of an Excel spreadsheet or a collection of hybrid data warehouses that are both cloud-based and on-premises.

Power BI makes it simple to connect to given data sources, see what’s essential, and discover what’s important and we can further share it with different people across.

Power BI has several options as Power BI desktop which can be used to data analysis and visualization. Power BI also has Power BI online service and Power BI mobile apps for both Android/ios/Windows devices.

Here we will go through the small example how you can connect Power BI with Jupyter and start playing around.

Step 1 :

Install powerbiclient in your system using pip : pip install powerbiclient

Step 2 :

Once package is installed open Jupyter notebook.
Import report and model from powerbiclient.

Step 3 :

Authenticate your power bi with Azure id which we will generated for each session and can be authenticated using browser.

Step 4 :

We can now setup the workspace id and report id which we want to embed in jupyter to work further.

If we want to validate the report we can use Microsoft api also which is given as below:

We can use https://docs.microsoft.com/en-us/rest/api/power-bi/reports/getreportingroup to get the report using API call.

Step 5 :

Now let’s create the report instance and pass above details to get report loaded in Jupyter.

The package documentation can be found in the GitHub repository wiki.

--

--

Swapnil Bandgar
Nerd For Tech

Code is like humor. When you have to explain it, it’s bad. Connect with me on LinkedIn : https://www.linkedin.com/in/imswapnilb