ms-power-bi-javascript-api

Introducing the new Power BI JavaScript API

Written by Josh Caplan as seen on MicrosoftCorporation
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.
Power BI embedded iframe without Javascript API
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.
Power BI embedded iframe with Javascript API
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:
Power BI JavaScript API diagram
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
    • Set access token
  • Configure the report with the following settings:
  • Enter and exit full screen mode
Learn more about embedding a report
Navigate to Pages in a Report
The JavaScript API enbales you to discover all pages in a report and to set the current page. Try the navigation demo application.
Learn more about page navigation
Filter a Report
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.
const basicFilter: pbi.models.IBasicFilter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "Store",
    column: "Count"
  },
  operator: "In",
  values: [1,2,3,4]
}
ADVANCED FILTERS
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:
const advancedFilter: pbi.models.IAdvancedFilter = {
  $schema: "http://powerbi.com/product/schema#advanced",
  target: {
    table: "Store",
    column: "Name"
  },
  logicalOperator: "Or",
  conditions: [
    {
      operator: "Contains",
      value: "Wash"
    },
    {
      operator: "Contains",
      value: "Park"
    }
  ]
}
Learn more about filtering
Handling Events
In addition to sending information into the iframe, your application can also receive information on the following events coming from the iframe:
  • Embed
    • loaded
    • error
  • Reports
    • pageChanged
    • dataSelected (coming soon)
Learn more about handling events

Delivering bipartisan data on Super Tuesday

By Stan Freck as written on enterprise.microsoft.com

At Microsoft, we believe technology can create a more secure, accurate, and efficient election experience. We recently supported the 2016 presidential election process by providing advanced technology to help organizations on both sides of the aisle manage their campaigns on Super Tuesday, the biggest day of the 2016 primary season.

Super-Tuesday

Our goal throughout the election process is to enable presidential candidates, regardless of their views, to use technology to more effectively manage their campaigns. Here are a few examples of how both Republicans and Democrats are embracing innovations from Microsoft and its partners to improve the election process, including Super Tuesday:
•The Republican National Committee (RNC) is using Microsoft Power BI to create rich dashboards that enable party officials to bring vast amounts of data to life, thereby quickly spotting trends. With 3 terabytes of data to manage, the RNC needed to make this information easily accessible to a variety of stakeholders, including those who aren’t data savvy. “We were able to do that through Power BI,” says Conor Maguire, Director of External Support for the Republican National Committee. “I think it’s going to revolutionize our reporting and dashboarding for this cycle.”
•The Democratic National Committee (DNC) is using Microsoft Dynamics to improve its tracking system for assigning volunteers to polling places and for identifying and addressing any voter issues that may arise. By rebuilding its tracking system on Microsoft Dynamics, the tool is now far easier to use. “We had real confidence that by working with the campaigns and with Microsoft, we were going to make the product better,” says Pratt Wiley, the DNC’s national director of voter expansion. “I think .”
•CMDI, which provides innovative fundraising and compliance solutions for Republican political organizations, hosts its integrated platform Crimson v2 in the cloud on Microsoft Azure, offering a reliable way for customers to access data—anytime, anywhere. “We don’t have to wake up our IT director in the middle of the night because the server’s gone down,” says Jack Simms, Vice President of CMDI. “It’s running in Azure, we have a backup, and we’re good to go.”
•NGP VAN, a leading technology provider to Democratic and progressive campaigns and organizations, has been moving its integrated campaign platform to Microsoft Azure, so its customers can easily scale up and down as demands change. Says Stu Trevelyan, CEO of NGP VAN, “Campaigns tend to be very spiky in terms of their activity and that’s a really good use case for Azure. We’re able to scale it up really effectively and very quickly.”
These are just a few of the ways that Republican and Democratic organizations are taking advantage of Microsoft technology to make informed decisions about their campaigns on Super Tuesday and throughout the 2016 presidential election process. To learn more about our efforts, please watch our Super Tuesday video. Also, see my recent blog post, “Microsoft technology powers the 2016 Iowa caucuses.”

Contact us Today!

Chat with an expert about your business’s technology needs.