Using Flow and Power BI to track social listening through Twitter


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

image

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”

image

2.  In this example we will be using the API based Datasets

image

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:

  • Text
  • Number
  • DateTime

image

The Twitter activity outputs the following data:

User

  • Description
  • Location
  • Name
  • User name

Tweet

  • Description
  • Location
  • MediaURLs (Item)
  • Name
  • OriginalTweet.MediaURLs (Item)
  • Retweet count
  • Tweet text
  • Tweeted by
  • User name

image

In Power BI that dataset would look like the following.

image

image

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

https://flow.microsoft.com/en-us/documentation/apply-to-each/

 

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.

image

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.

image

 

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.

image

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!)

 

image

 

8.  Create a Power report that shows the Twitter Data

 

image

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.

image


Comments (0)

Skip to main content