DEV Community

Nyamatari Brian
Nyamatari Brian

Posted on Edited on

# HOW TO EMBED A POWER BI REPORT INTO A WEBSITE.

Introduction.

As we all know Power BI is a powerful analytics tool developed by Microsoft. The power it has usually enables us visualize data and give insights through interactive dashboards and give reports. This helps the transformation of raw data into meaningful information for better decision making in any field.

Here we are going to learn how to publish Power BI reports and embed it into a website.

Creating a workspace.

A workspace in PowerBi is a space where you store and manage your datasets like reports and dashboards.

Steps:

  1. Go to your PowerBi app.
  2. Click on workspaces in the left menu.
  3. Click Create workspace
  4. Enter a name of your choice.
  5. Click on save.

Uploading and publishing your reports.

After creating your report in Power BI, one needs to publish it online.

Steps:

  1. Open your '.pbix' file in Powerbi.
  2. Click on Publish from the home tab.
  3. Sign in into your account if required.
  4. Choose your workspace.
  5. Click on select.

Generating the embed code.

In order to display your report on a website, you need an embed link.

Steps:

  1. Open Powerbi service.
  2. Go to your workspace.
  3. Open the report of your choice.
  4. Click on file then embed report and publish to web.
  5. Create the embed code.
  6. Copy the iframe code.

Embedding the report on a website.

One can embed a report using HTML.

Example:

Embedding a specific page.

To load the specifications of a report on a page load, append the pagename parameter to the src url:

Example:

src="https://app.powerbi.com/reportEmbed?reportId=YOUR_REPORT_ID&pageName=ReportSection2"

Important insights and best practice.

  1. Applying Row-Level Security. (RLS)

Even before publishing the dashboard to a public or semi- public audience, define RLS roles in powerbi to restrict which rows of the fact, customer or location tables individuals users can see

  1. Use Premium capacity for scale.

Powerbi premium lets you embed reports without requiring every viewer to have a pro license. This is good for public facing websites where visitors volumes are unknown.

  1. Schedule data refresh.

The data scales in the dashboard is statistical unit refreshed. One needs to set up a data gateway and configure a schedule refresh in the preferred choice of the one doing it in the workspace settings so the embedded reports always reflect current figures.

  1. Make the embed responsive.

To ensure it is responsive always us the padding-top wrapper approach so that the dashboards scales cleanly on mobile and desktop screens without horizontal scrollbars.

  1. Control which page loads first.

The use pagename URL parameter to decide whether visitors land on the summary dashboards, the profit margin drill-down depending on your audience.

  1. Monitor usage.

In every usage one must use the Usage metrics report in the workspace to track how many users view embedded report and which pages they visit most and peak viewing times.

  1. Secure sensitive data.

In every work done one must secure their data which involves scenarios whereby users embed power bi. This uses a service principal and generates token server-side, keeping data protected behind authentication.

Conclusion.

This guide started from raw data to finally embedding powerbi.

Top comments (0)