My favorite solution template for Power BI is the Campaign/Brand Management for Twitter template that does an amazing job of analyzing your social presence through Azure Logic Apps, Machine Learning and SQL Azure
For most my scenarios i don't need all the bells and whistles of the solution template and Flow provided a very light weight way of analyzing your social listening.
Specifically using Flow to trigger an activity based on a specific keyword and inserting the twitter data into a Power BI dataset.
This post will walk you through the directions to create exactly that. The first thing needed is to create the PowerBI Dataset to receive the twitter data.
To Create a Power BI Streaming Dataset
1. Open PowerBI.com Select Datasets, choose streaming datasets and select “Add streaming dataset”
2. In this example we will be using the API based Datasets
3. The next step is to define a data set that matches the data the Twitter activities is retrieving. For better or worse real time streaming datasets only allow three datatypes:
The Twitter activity outputs the following data:
- User name
- MediaURLs (Item)
- OriginalTweet.MediaURLs (Item)
- Retweet count
- Tweet text
- Tweeted by
- User name
In Power BI that dataset would look like the following.
For the sake brevity this article will exclude the two MediaUrls with outputs of type Item.
If you do want to play with those, check out how to iterate through a list of items
4. Create the Flow that triggers and collects the Twitter information.
To do this navigate to http://flow.microsoft.com, login and click on My flows.
Luckily for us there are a couple of templates that does much of what we want like the “Save Tweets to Google Sheet”, “Save Tweets to SharePoint List” or the “Save Tweets to Excel File”.
In this case i have opted to start with the “Email myself new Tweets about a certain keyword” as it also retrieves the user details.
6. Modify the Flow to include the Power BI activity, that inserts the data into the Power BI data set.
To do this is click on “Add an action”, search for “Power BI” and select the Power BI Add Rows to a dataset activity.
7. Map the Twitter output to the Power BI Activity that inserts the data into a Power BI Row.
As you can see from the screen shot below. The Power BI activity prompts you for all the data needed to make this happen.
In the screen shot below I have deleted the email activity and attempted to save the Flow before adding the hashtag for the tweets i wanted.
(Don’t include any spaces like i am showing for the hashtag and you should probably rename the Flow since it is no longer sending email!)
8. Create a Power report that shows the Twitter Data
Throwing a couple of visuals on the report i found it interesting the ESRI map understands Twitter locations (mixed up ordering, incomplete etc)but the Bing maps don’t.