Embedded analytics using Microsoft Power BI

14 Nov, 2019
Xebia Background Header Wave

Introduction to Embedded Analytics

Before we get to embedded analytics, just a few words on analytics, for beginners.

Data is ubiquitous. In today’s connected environment, every organization and business out there deals with loads of data, sometimes tons of it (aka big data). Analytics is the process of applying quantitative techniques to analyze and interpret data sets and discover broad patterns to guide decision making.  Analytics stands tall on the pillars of statistics, computer programming, and operations research. Analytics and Business Intelligence (BI) have become very important solution areas in today’s world, because they help in turning raw data into actionable insights, to guide business decisions and drive increased revenues, customer retention, cost optimization, and better targeting. Action is the keyword here. There are many business use cases, and analytics is relevant for every business domain and industry vertical, period.

What is embedded analytics? Let me elaborate with an example. Imagine a scenario where John is an end-user and he is logged into some business application (let’s call this as web app X) and is working with total focus. He wants to analyze some data and understand the patterns before he takes some decisions – and to do that:

  • John must stop his work in the web app X
  • he will have to login into a separate BI platform (which may be a centralized portal used across the organization)
  • do his data analysis magic there and
  • come back to his web app X to resume his original workflow

Why? Typically, BI is not integrated into most business applications! This is inconvenient and very disruptive to a user’s natural flow of work, to say the least.

Enter Embedded Analytics! Embedded Analytics helps businesses to seamlessly integrate powerful BI capabilities directly into their applications, mobile apps, products, and web portals. With embedded Analytics, you can make analytics reports, dashboards, meaningful data visualizations, available at the fingertips of your customers, employees, partners or end-users – within their natural workflows.

Benefits of using Embedded BI

  • As a business user or developer, you can focus on your core expertise of building your product, rather than on building BI from scratch
  • With embedded analytics, you can provide self-service analytics solutions to your customers that are easy to customize, integrate, and deploy
  • Users can make data-driven decisions with the help of visual analytics
  • You can get to market faster while staying focused on your area of expertise
  • It helps you deliver a great interactive product experience to your customers
  • Embedded Analytics seamlessly enables users to ask the right questions and discover actionable insights easily

Some Business Use cases

  • Marketing campaign optimization
  • Sales lead conversions
  • Inventory demand planning
  • Financial budgeting
  • Consumer Analytics
  • Supply Chain analytics

Embedded Power BI from Microsoft, is an offering primarily for developers and software businesses, and it comes with rich features and many developer tools. Power BI helps in embedding stunning data visualizations in any platform, product, website, portal, or service. If you want to explore other choices, there are many popular options in the market  such as Tableau, Gooddata, Qlik Analytics Platform, etc. 

In this post, let us explore and learn about Embedded Power BI.

Where can you embed Power BI Analytics?

  • If you are an application developer, you can embed in your application or web portal or mobile App
  • You can embed Power BI analytics in your organization’s internal applications and portals
  • You can embed in Microsoft Teams
  • You can embed in SharePoint Online
  • You can even embed it into a blog!

How to embed Power BI in your application

Let us understand at a high level, how you can embed Power BI in your application, as an example, in this post. If you are working with Azure Active Directory (AD), follow the procedure detailed below to embed Power BI reports, dashboards, or tiles into any application:

  • Pre-requisites
    • You need to have a Power BI Pro account with Azure access (also known as a Master account) OR alternatively, a Service principal (app-only token) that uses an application ID and an application secret to authenticate the application.
    • You also need to have your own Azure AD tenant setup.
  • Step 1: Register your application in Azure AD
    • This is needed for your application to access Power BI REST APIs, the core magic that helps you embed analytics reports.
  • Step 2: Provision Power BI Embedded Capacity in Azure
    • you can skip this step if you are only in the development or testing phase. You will need dedicated BI embedded capacity only when you are ready to transition into production.
    • If you are using a master account, you need to register a Native app.
    • If you are using the service principal, you need to register a server-side web application app. That will help you to create an application secret.
  • Step 3: Place your content – Analytics reports, dashboards, or tiles into a new Workspace in Power BI
    • Generally, you can create reports and datasets using Power BI Desktop and then publish those reports to a workspace. 
    • If you are using a master account, then you can publish your report through Power BI Desktop. And if you are using a service principal, you must use the Power BI REST APIs.
  • Step 4: Generate an Embed Token
    • There are many ways to generate an Embed token, which are needed to be used from the JavaScript API (as explained in the next step)
    • There are 5 APIs that can be used to generate Embed tokens. Note that the token you generate using these APIs is specific to the item you’re embedding like a Dashboard or a Report or a Tile
      • Dashboards GenerateTokenInGroup
      • Datasets GenerateTokenInGroup
      • Reports GenerateTokenForCreateInGroup
      • Reports GenerateTokenInGroup
      • Tiles GenerateTokenInGroup
    • There is also an API for generating an embed token for multiple items and it is the Generate Token embed API. This is an alternate option.
    • Is there an easier way? Yes! You can also use Azure functions as an easy way to generate tokens
    • Once Authentication is complete, the Azure function will invoke Power BI API to construct a json response which will contain the Embed token
  • Step 5: Embed analytics content into your application, using Power BI JavaScript Library
    • You can use JavaScript to load a report into a div element on your web page.
    • Or you can even write your own simple html page to demonstrate the embedding – a page which includes jQuery and Power BI JS, and uses the embed token for successfully embedding Power BI content into your own web page
    • For detailed documentation on how to use JavaScript API, you can visit the Playground tool hosted by Microsoft.

Microsoft has some excellent documentation for guided learning –, if you need detailed tutorials.

Here are some sample screenshots on how an embedded Power BI report will look like in web and mobile applications:






Many businesses want to place the power of analytics in their employees’ hands and want to reap the benefits of better/faster decision making with actionable insights. However, the adoption of centralized BI systems has been a challenge with end-users. One of the key pain points is the disruptive workflow and the need to toggle between different applications to access meaningful analytics. Embedded Power BI solves that problem and allows you to place stunning data visuals, and analytical content directly into your applications. So, irrespective of whether you want to enable wider usage of analytics in your business or you wish to enable your customers to have easy access to analytics, Embedded Analytics is the way to go forward.

Rohini Lingambhotla
Rohini is a senior technology professional. She is deeply passionate about emerging technologies such as IoT, AI/ML and has a keen understanding of how to leverage them to deliver differentiated, innovative technology solutions.

Get in touch with us to learn more about the subject and related solutions

Explore related posts