Today we are excited to announce the release of our new JavaScript API, which provides bidirectional communication between Power BI reports and your application. The JavaScript API enables you to more easily embed reports into your applications and to programmatically interact with those reports so that the applications and the reports are more integrated. Two of the key features to call out with today's release are: much more advanced filtering of reports, and control over page navigation.
With this new functionality your application can open reports with the correct context for your users, as well as change that context after the report has already been loaded. For example, you could open a report to a specific customer and change that customer automatically as the user interacts with other parts of your application.
How does embedding with Power BI work?
To best understand the benefits of the Power BI JavaScript API, let’s examine how embedding in Power BI currently works. Embedding a Power BI report in your application is done with an iframe, which is hosted as part of the app. The iframe acts as a boundary between your application and the Power BI report. With no way to pass infromation through the iframe, the report cannot interact with your application and your application can’t interact with the report. While the iframe can make the embedding process a lot easier, this lack of interaction between your application and the Power BI report can sometimes make it feel like the report is not really part of your application.
Now the new Power BI JavaScript API will allow you to write code that can securely pass through the iframe boundary, so that your application can programmatically perform an action in a report and listen for events from actions that users make from within the reports themselves.
What can you do with the Power BI JavaScript API?
With the JavaScript API you can manage reports, navigate to pages in a report, filter a report, and handle embedding events. The following diagram shows the structure of the API:
Manage Reports
The JavaScript API enables you to manage behavior at the report and page level:
Embed a specific Power BI Report securely in your application - try the embed demo application
The JavaScript API provides basic and advanced filtering capabilities for embedded reports and report pages. Try the filtering demo application, and review some introductory code here.
BASIC FILTERS
A basic filter is placed on a column or hierarchy level and contains a list of values to include or exclude.
Advanced filters use the logical operator And or Or, and accept one or two conditions, each with their own operator and value. Supported conditions are:
Microsoft Power BI helps you stay up to date with the information that matters to you. With Power BI, dashboards help you keep a finger on the pulse of your business. Your dashboards display tiles that you can click to explore further with reports. Connect to multiple datasets to bring all of the relevant data together in one place.
If you have important data in Excel or CSV files, you can create a Power BI dashboard to stay informed anywhere and share insights with others. Do you have a subscription to a SaaS application like Salesforce? Get a head start by connecting to Salesforce to automatically create a dashboard from that data, or check out all the other SaaS apps you can connect to. If you are part of an organization, see if any organizational content packs have been published for you.
If you're in your workspace, select Get Data at the bottom of the left navigation pane.
Select Files.
Select Local File, browse to the file on your computer, and choose Open.
Power BI uploads the CSV file and adds it as a new dataset (the yellow asterisk indicates a new item). Since we did not already have a dashboard, Power BI also created a new dashboard for us. In the left navigation pane, the new dashboard is listed under the Dashboards heading, and the new dataset appears under the Datasets heading.
Step 2: Start exploring your dataset
Now that you have connected to data, explore to find insights. When you've found something you want to monitor, you can create a dashboard to keep up-to-date with changes.
Select the dataset image on the dashboard to explore the data you just connected to or, under the Datasets heading, right-click the dataset name and select Explore.
In the Fields list on the right side of the page, select fields to build a visualization. Select the checkbox beside Gross Sales and Date.
Power BI analyzes the data and creates a visual. If you selected Date first, you'll see a table. If you selected Gross Sales first, you'll see a chart. Switch to a different way of displaying your data. Try changing to a line chart by selecting the line chart option.
When you have a visualization you want on your dashboard, hover over the visualization and select the Pin icon. When you pin this visualization, it will be stored on your dashboard so you can track the latest value at a glance.
Because this is a new report, you need to save it before you can pin a visualization from it to the dashboard. Give your report a name (e.g., Sales Over Time) and select Save and Continue.
The new report appears in the navigation pane under the Reports heading.
Pin the tile to an existing dashboard or to a new dashboard.
Existing dashboard: select the name of the dashboard from the dropdown.
New dashboard: type the name of the new dashboard.
Select Pin.
A Success message (near the top right corner) lets you know the visualization was added, as a tile, to your dashboard.
On October 22, 2015 marks the launch of Microsoft Mechanics, an official new show and video platform for IT professionals and tech enthusiasts. Shows comprise informative demos, how-tos and insights from the engineers and tech leaders behind our technology each Wednesday or as news breaks, all in around ten or so minutes.
Beyond the news and blog announcements, it’ll help you to see the technology for yourself, get broader context and understand the potential application so that you can decide whether or not to explore further.