We’re excited to announce a new form of Power BI embedded analytics that enables you to embed an interactive data exploration and report creation experience in your applications. With this solution, you’ll be able to provide your users a similar experience to our integrations in Dynamics 365 and SharePoint.
By using this new set of Power BI client APIs, your application can pass in data source information, and Power BI will automatically generate a dataset and report for your users to explore, modify, and if they choose, save to a workspace in their Power BI tenant.
To set this up, you’ll need to create a configuration object to store information about your data source and customize the report that’s initially created. As part of this, you’ll be able to pick how you want to connect your app’s data to Power BI. You can either pass an array of data directly to Power BI, or you can use a Power Query connector by passing in a mashup document.
Passing in the data directly is a very easy way to get started. It’s aimed at smaller amounts of data, up to 16MB in size, and doesn’t require you to develop your own connector. Since you’re passing in the data directly, it’s not refreshable in the future, so more suited towards enabling your users to explore their data to answer a point in time question.
You’ll pass in data as rows using a simple format, for example:
const data: IDataTable = [ { "name": "Table", "rows": [ ["Product1", "20", "2022"], ["Product2", "35", "2021"], ] } ]
In addition to name and dataType, you can specify default aggregation on columns by providing an optional property aggregateFunction
for each column. The number for supported aggregate functions are based on the AggregateFunction Enum type.
You can see the full details of how to use this configuration option in “Create a dataset without a data source” section of our documentation.
On the other hand, by using a data connector, you’ll be able to enable your users to create refreshable, reusable reports and datasets. This route requires you to create a Power Query connector or expose your data through one of our existing data connectors, but users will be able to visualize much more data and return to their reports in the future to see the latest data. We currently support anonymous data connections or authenticating with AAD tokens, and in the future, we’ll enable support for other authentication methods.
To use this method, you’ll just need to pass in a mashup document and the data model configurations, for example:
const datasetCreateConfig: IDatasetCreateConfiguration = { "modelName": "temp model", "locale": "en_US", "mashupDocument": "section Section1; shared Table = let Source = Csv.Document(Web.Contents(\"https://yourdomain.com/sample.csv\"),[Delimiter=\",\", QuoteStyle=QuoteStyle.None]), #\"Promoted Headers\" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]) in #\"Promoted Headers\";", "dataSourceConnection": { "credentialType": CredentialType.Anonymous, // =1 "dataCacheMode": DataCacheMode.Import // =1 } }
You can see the full details of how to use this configuration option in “Create a dataset with your existing data source” section of our documentation.
This new embedding option is a form of SaaS embedding, so your app users will need to sign into their own Power BI account to generate the report and dataset. This means it’s free for you to include in your application. While your users will need to sign up for Power BI, if they don’t already have an account, they’ll only need to have a free license to explore their data and save it into their personal workspace.
We hope this new embedding option gives you more flexibility when integrating with Power BI and an easy option to start offering data exploration and report creation capabilities to your users. To see full details, be sure to check out our API documentation and detailed tutorial. And of course, let us know if you have any feedback or questions in the comments!