Facebook page insights with Power BI – Part 2

On my last blog post here we built a dashboard that analyzes the count & geolocation of users who talk about Power BI, Tableau or Qlik on facebook. In today’s post we will take the dashboard one step further and provide insights on the trend of each brand over the last 90 days.

Follow this tutorial to know how to analyze the trends of multiple brands. In our exmaple – We analyze the people who are talking about Power BI, Tableau & Qlik.

Screenshot_30
Click the screenshot to access Power BI Dashboard

Before we start, here are some cool insights on Zombies

Let’s use the dashboard above to analyze the data . As you can see from the line chart that is highlighted below, on February 5, Qlik enjoyed a sudden burst of shares on Facebook. Screenshot_31

Looking at Qlik’s Facebook post here, I initially suspected that the peak originated from this scary Walking Dead dashboard:

Screenshot_21

But I was probably wrong. On the same day Tableau also got a burst of Facebook shares. So there was a different event that triggered this massive enthusiasm among BI fans – Can you guess?

 

Screenshot_33.png

So Gartner published their report on February 4, and the BI leaders took advantage of their achievement and celebrated the news. For some reason Microsoft didn’t enjoy the same peak. I didn’t find a relevant post on Power BI Facebook page. Perhaps it explains the missing burst of shares for Power BI.

Anyway, the bottom line of this quick data analysis – Don’t trust Zombies when you perform data analysis.

The Walkthrough

To start this walkthrough open the .pbix file that we have created on our last blog post here. Don’t forget to use the latest Power BI Desktop.

In Home tab, click Edit Queries.Screenshot_1

Click on the query GetInsightsByPage, and then click Advanced Editor.Screenshot_2

Modify the line that starts with:

   Source = Facebook.Graph(…

First, change the version number from v2.2 to v2.5 and add the highlighted text:

Screenshot_34

After clicking Done, you will get the following error. Ignore it, we will fix it in a minute.Screenshot_4

Note that by the changes above, we “tricked” Power Query to use REST API calls  with version 2.5 of the Graph API instead of version 2.2, which Microsoft officially supports. The reason for this change is that the latest version works better with Page Insights, and returns data of longer periods.

In Home tab click New Source drop down button and select Blank Query.

Rename the new query to SincePeriod.

Screenshot_10

In the formula bar of the query SincePeriod enter the following formula:

= DateTimeZone.FixedUtcNow()

Notice that this formula returns the current fixed UTC date and time.Screenshot_6

Let’s subtract 90 days from the current date and time:

Just change the the formula by subtracting Duration.From(90):

= DateTimeZone.FixedUtcNow() – Duration.From(90)

Screenshot_22

Now we can convert the date & time to date by applying Date.From on the previous formula:

= Date.From(DateTimeZone.FixedUtcNow() – Duration.From(90))

Screenshot_23

Now we will convert the date to text by applying Text.From on the previous formula.

= Text.From(Date.From(DateTimeZone.FixedUtcNow() – Duration.From(90)))

At last our query SincePeriod returns the expected textual date, we can continue to work on our queries.

Select the query Share Results.

Select the column Time, click Date Type: Any, and then click Date in the drop down menu.

Click Close & Apply in Home tab, and you are ready to build new time-dependent visualizations.

And here is a dashboard that you can create as a result:

2 comments

  1. Pingback: An update for the brave analysts of Facebook Insights and #PowerQuery | Data Chant

  2. Pingback: Analyze Facebook Insights with Excel – Data Chant

Leave a Reply