Today, I am happy to announce an exciting new update to the Power BI connector for Microsoft Flow. Coming hot on the heels of our data alert Flow trigger, we have added a new action which pushes rows of data to a Power BI streaming dataset.
Since their release last year, thousands of users have used Power BI streaming datasets to easily build real-time dashboards by pushing data into the REST API endpoint, and having that data update in seconds on their streaming visuals. With this connector, this process can now be automated without writing a single line of code. Simply create a Flow with the “push rows to streaming dataset” action and Flow will automatically push data to that endpoint, in the schema that you specify, whenever the Flow is triggered. Even better, you’ll be able to choose from hundreds of Flow triggers to act as data sources.
The richness of the Flow ecosystem enables countless use cases for this action. Create a Flow to monitor the Twitter sentiment in Power BI via incorporating the Twitter trigger and the Microsoft Cognitive Services Sentiment Analysis action. Add real-time weather data into your dashboards via the MSN Weather trigger. You could even create a log of the Power BI data alerts that have been triggered by piping the alert trigger into a streaming dataset.
To get started, jump over to Flow to begin building your own Flows. Read on for a full end-to-end tutorial.
End-to-end tutorial: gauging Twitter sentiment with Flow and Power BI
In this tutorial, we will create a real-time dashboard which charts the sentiment of a keyword on Twitter. You could imagine using this dashboard to monitor the status of your social media campaign in real-time in Power BI. We’ll start by creating a streaming dataset in Power BI, and then from there push Twitter sentiment data to that dataset via Flow.
Creating the streaming dataset in Power BI
To create the Power BI streaming dataset, we will go to the powerbi.com and “Streaming datasets.”
From there, we will create a dataset of type API:
Name the dataset whatever you want (but remember the name!). Then, add the following fields to the streaming dataset:
To summarize – we’ve now created a dataset with the following fields
- time (DateTime) – when the Tweet was sent
- tweet (Text) – the contents of the Tweet
- sentiment (Number) – a number between 0 and 1, representing the sentiment of the tweet, with 0 being extremely negative, and 1 being extremely positive
Create a Flow to push Tweet sentiments to Power BI
Next, we will create a Flow which will push Tweets and their sentiments to Power BI. Start by navigating to Flow. Sign in, and then go to “My Flows”, then “Create from blank.” You should see the following:
Now, click the Twitter category, and select the “When a new tweet is posted” trigger, and enter your search term. For the purposes of this walkthrough, we’ll use “PowerBI.” As the title suggests, this trigger will start a Flow whenever a tweet which contains the search term is posted.
Next, we will pipe these Tweets into the Microsoft Cognitive Services Sentiment Detection Flow action to understand the positivity of the Tweet content. This action takes in a Tweet, and outputs a number from zero (very negative) to one (very positive).
Select “New Step,” then “Add an action,” then search for “Sentiment Analysis” and select the “Cognitive Services Text Analytics – Detect Sentiment” action. To continue, you’ll need an API key with Microsoft Cognitive Services – you can get one for free.
Once you’ve entered your API key and related information, go ahead and pipe in the Tweet text to the sentiment detection action by selecting it from the dynamic content pane on the right side of the screen. Your Flow should now look like the following:
Now, we’re at the last step of the Flow: we’re going to push this data into the Power BI streaming dataset that we created earlier. Go to “New step,” then “Add an action,” and then enter “Power BI” into the search box. Select “Add row to streaming dataset” from the actions list.
Select the name of the workspace, then the name of the streaming dataset in the first step, and select the Table titled “RealTimeData.” Note that all streaming datasets created in powerbi.com will have one table named “RealTimeData.” Next, in the data field, add the following:
Go ahead and give your Flow a name, and select “Create to Flow” to start the Flow.
Building the real-time dashboard in Power BI
Now that the data is flowing, the last thing we’ll want to do is create a dashboard with a streaming visual in Power BI. Back in Power BI, go to a dashboard, select “Add tile,” then “Custom streaming data” and finally the name of the streaming dataset that we created in the first step. Configure the streaming visual as follows:
You should now see a line chart appear in your dashboard, graphing the Tweet sentiments over time. And you’re done!
Consider for a second that we’ve built a fairly complex pipeline of components, spanning social media, Artificial Intelligence and Business Intelligence domains, all in a short amount of time and with zero lines of code – no small feat!
For more ideas on Flows, check out the Flow templates page to see a gallery of the most popular ideas. We’ll also be adding several Flow templates with the new “Push to streaming dataset” action, including the one featured in the tutorial above – so stay tuned for that.
Have an idea for another way that Power BI can connect to Flow? Head to the Power BI UserVoice and cast your vote to make your voice heard.
Made a cool Flow? Share it with the community! Either post in the comments below, or in the Power BI forums. Your Flow might even be featured in the next Power BI Flow blog post!