Analyze Your Business's Facebook Page with Power BI

October 1, 2018

 

Authors' Note: Since writing this post, Facebook has updated their privacy policy, and you must grant access through Facebook in order to use the PowerBI Facebook connector (API). This means that, if you don't own the Facebook page, you will not be able to use this. If you do own the Facebook page, you will need to follow the instructions listed here: https://developers.facebook.com/docs/apps/review

Power BI comes with a Facebook connector that allows you to analyze your Facebook page's posts and comments - your business's page as well!

 

In the above dashboard, I've selected Starbucks as an example.

 

Upon opening the template, you'll be prompted to enter two parameters; the business's page name and the beginning date.

 

Be sure you are connected to the Internet. You'll also need to make sure that the company page actually exists first, and double check the spelling - it needs to be exactly the same as the Facebook URL. Click "Load" and Power BI will go fetch the data from Facebook.

 

To change the company at any point, simply select: Home -> Edit Queries -> Edit Parameters.

 

 

 

 

Alien Tip: If the page is really active and receives many comments (greater than a million), the query may take a while to load. If the query fails, there may be too much data. In this case, you need to shorten the date range by selecting a closer date to today.

 

I've used a combination of conditional formatting and storytelling elements to bring the page together. I also created custom tooltips for each visual. See below if you'd like to read about how I did it.

 

Overall Dashboard Design

 

I went with a minimalistic approach for the design of the dashboard, using a light shade of blue for all data points. There are two main sections divided with using a visual hierarchy of a white tile and light grey background. This is very similar to the Google Trends dashboard. You can read more about their designs in my Google Trends blog post.

 

 

Line Graph

 

 

This is a standard line graph with some elements removed from it like the y-axis, border, and gridlines. I added data labels to each point because I felt those were the most important parts to highlight for the user. The custom tooltip simply displays the count and the percentage difference from the last period along with helpful text for either "Up" or "Down". This graph follows some of the principles I talk about in my Storytelling with Data blog post.

 

 

Top Posts

 

 

This list shows the top posts where comments meet or exceed 100. The bars on the right side actually reflect the Log10 of the number of comments. I noticed that if I used the actual number of comments, there would be one or two posts with 2000 or higher comments, and the rest would maybe only have 200 - 300. This didn't show well with the bars, so using log10 puts all of them on a relatively close scale. The tooltip, however, does show the user the actual number of comments. 

 

 

Heatmap

 

 

This was the most time consuming part of the dashboard. I originally wanted to use a custom visual specifically designed for a heat map, but I ultimately went with the standard matrix due to it's flexibility. I added conditional formatting for both the cell background and text based on the count. Applying the formatting to both effectively "hides" the number value on the matrix. 

 

 

Enlighten Data Story

 

 

I calculated the mode (most frequently appearing) of the day in order to get this one. The DAX code is a bit more complicated than usual, but nothing you can't easily implement yourself.

 

DAX Mode Calculation

- Without Comments -

 

Most Popular Day =
FORMAT(
MINX (
    TOPN (  
        1,
        ADDCOLUMNS (
            VALUES ( FB_Comments[Created Day] ),
            "Frequency", CALCULATE ( COUNT ( FB_Comments[Created Day] ) )
        ),
        [Frequency], 
        0
    ),
    FB_Comments[Created Day]
),
"dddd")

 

- With Comments -

 

Most Popular Day =
FORMAT(
// Format into string for the name of the day i.e. Sunday, Monday
MINX ( // Minimum for grabbing the first value in the TopN function below
    TOPN (  
        1,
// Tell TOPN to return only one row
        ADDCOLUMNS ( // Create the temp table to feed into TOPN
            VALUES ( FB_Comments[Created Day] ), // Feeding in the main field
            "Frequency", CALCULATE ( COUNT ( FB_Comments[Created Day] ) )
        ),
// Naming our new Column "Frequency" and counting the instances
        [Frequency], // Telling TOPN we want the "Frequency" column
        0 // Zero for default descending order
    ),
    FB_Comments[Created Day]
// Giving MINX the expression
),
"dddd")
// Formatting it as full day name.

I did this for both the day and time, and fed these measures into the enlighten data story custom visual.  

 

 

Custom Tooltips

Change the report page to a tooltip page

You can create custom tooltips in Power BI like the ones I'm using in this dashboard. Custom tooltips are report pages designated as a tooltip. You can do this via the formatting options on any page and turning on the tooltip option.

 

Be sure to give it a name as well, as you'll need to refer to it when choosing which tooltip to show on your visuals. The tooltip will function just like the default one i.e. it will pop up when you hover over any data point and automatically filter the data to that specific point. 

 

Make sure to adjust the size of the report for your tooltip. You can choose a set of predefined options, or set a custom dimension under the Page Size section. I set a custom size of 170w & 82h.

 

 

 

Switch the default tooltip to your custom one

To change the tooltip from the default option to custom ones you've created, select any visual and navigate to the tooltip section under the formatting options. Turn the option to "On" and change the type to "Report Page". Then choose which one you want to use under the Page dropdown box.

 

 

Let me know what you thought in the comments! Do you have a Facebook analyzer you built yourself? I'd be happy to hear!

Getting started with Power BI? You can get begin with Power Pivot and Power BI by Rob Collie and Avichal Singh:

 

 

Please reload

About the Author

Brent Jones loves spending time with his wife and trying out new activities together.  They traveled as digital nomads to many countries in South America, Europe and Asia. He can also speak Japanese!

Our Recent Posts

Please reload

Tags

Address

7000 Central Pkwy #1100, Atlanta GA 30328

Follow

  • Twitter - Black Circle
  • Black Pinterest Icon

©2019 BY ANTARES ANLYTICS. PROUDLY CREATED WITH WIX.COM