This document discusses how Power Query can be used to analyze Facebook data and tell stories from that data. It explains how to connect Power Query to Facebook to extract friend data, likes, and post feeds. It then demonstrates using Power View to visualize that Facebook data through charts and graphs to analyze trends over time, such as the gender of friends, music likes, when friends were added, and patterns of Facebook activity. Power Query and Power View allow users to explore and gain insights from their own Facebook data.
1. Microsoft Excel | Power Query | Power View
Using Power Query to tell
your story form your
Facebook Data.
Microsoft Excel | Power Query | Power View
Anil Maharjan
2. Page | 1
Using Power Query to tell your story form
your Facebook Data.
Most of the time of this weekend, I spent my time to extract the story behind my Facebook data by using
Power Query. Power Query can connect data across a wide variety of sources, where facebook is one of
the data source. By using Power Query you can extract your facebook data easily and do analysis your
own story by using your own facebook data.
Talking about Power Query: Microsoft Power Query for Excel is an Excel add-in that enhances the self-
service Business Intelligence experience in Excel by simplifying data discovery, access and collaboration.
Microsoft Power Query for Excel, is a new add-in that provides a seamless experience for data discovery,
data transformation and enrichment for Information Workers, BI professionals and other Excel users.
With Power Query you can:
Identify the data you care about from the sources you work with (e.g. relational databases,
Excel, text and XML files, OData feeds, web pages, Hadoop HDFS, Facebook Data etc.).
Discover relevant data from inside(*) and outside your organization using the search
capabilities within Excel.
Combine data from multiple, disparate data sources and shape it in order to prepare the data
for further analysis in tools like Excel and Power Pivot, or visualization in tools like Power View
and Power Map.
You can easily download from the link below:
http://www.microsoft.com/en-us/download/details.aspx?id=39379
You can find more about Power View, Power Map, Power BI and Q&A from the official Microsoft Power
BI site. http://www.microsoft.com/en-us/powerBI/default.aspx
Now, I think you have installed Power Query add-in in Excel 2013 professional edition,
So, let’s drill into your Facebook data to
extract your story.
3. Page | 2
Firstly you need to open Excel sheet and go to the Power Query ribbon bar in Excel, then go to the ‘From
Other Source’ section where you will see the ‘From Facebook option’ from dropdown list.
Then you need to click the ‘From Facebook’ options which will open up Facebook login option, either you
want to access your account facebook data or another user. If you want to access another friend facebook
account then you can type username and login access. If you want to access your own facebook data then
you can use as me itself.
4. Page | 3
After that you have to choose the connection Name which is the type of information that you want to
query from facebook. Here I will chose the Friends type to list my all the facebook friends.
After clicking Ok button you will see the Facebook login screen to connect with your facebook account.
5. Page | 4
Now you can click Sign In button to access your facebook account.
Now, after successful login you can save your credentials within Power Query.so, you won’t need to re-
login. Also, if you want to change your credentials you can use data source settings as below.
6. Page | 5
Now, you can access your facebook data by using Power Query.
This is the Power Query output which listed all your friends on facebook cool .
Here, the object_link tab still contains future data you can see by clicking on Link inside object_link.
7. Page | 6
If you need to add more data to extract using Power Query then just click object_link tab where you can
include more data by selecting from dropdown menu.
Now just click done button which will extract facebook data into your excel worksheet by using Power
Query.
Now, it’s time to tell your story behind your facebook data.
8. Page | 7
Where Power View will help us to analyse the facebook data and give us some story to view. You can go
to Insert Ribbon tab and where you can see the Power View. Just click on Power View and you are ready
to analyse the story behind your facebook data.
To learn how to use Power View, you can go through detail from the site
http://office.microsoft.com/en-001/excel-help/power-view-explore-visualize-and-present-your-data-
HA102835634.aspx
9. Page | 8
Power Query Analysis 1 using Power View:
Now, let’s see how many of your friends are male and female.
Then , go to the Table section in left corner and choose Matrix from dropdown and choose the
object_link.gender field from the table fields in right side. Also copy the same analysis matrix and then
choose the Pie Chart option from dropdown lst when you select the Other chart section.
10. Page | 9
Similarly, I created another Power Query and another worksheet to analysis the music I likes in facebook.
Choose the music type while selecting the information type that you want to analysis from facebook data.
After that I use Power View to analysis based on total likes in particular artist or music bands that I also
liked too.
11. Page | 10
Power Query Analysis 2 using Power View:
Let's see when you have added your friends.
Through this analysis you can find out the total friends added in facebook, in which year, month.
First and recent friends connected within facebook.
You can know when you are connected with which friend.
Happy to see the results.
For this you need to select the feed type of information from the Power Query.
12. Page | 11
Then you will get the feeds from your facebook data also expand the object_link section then you will get
the worksheet as:
Here you need to add the extra column to list all the friends added data from your feed data, by using the
excel formula i.e. =IF(ISNUMBER(FIND("now friends",[@story])),"1","0") .
13. Page | 12
Similarly, you can add another columns for the proper date as year, month and period to proper analysis
using Power View.
For Year=LEFT([@[created_time]],4) , month ==RIGHT(LEFT([@[created_time]],7),2) and for
period==[@Year]&[@Month]
Now use the Power View to analysis your feed data to find out when you have added which friend and at
which time or year or month.
14. Page | 13
Now you will selected the year in row and friend added field from the table and set the filter of friend
added to 1 .
Now removed the friend added field from column .
15. Page | 14
Now copy the created sheet and go to column Chart option and select the Stached Column which will
gives you the year wise distribution of the friends added in your facebook. Also you can add period field
to find out the month wise distribution.
Now you want to know first and recent friends connected within facebook along with which time they
have added . You can get it by using period field in Tile By and story field in rows with friend added filter
field in column . This shows the first friends that you have added in facebook. Happy to see the result.
16. Page | 15
If you need to find out the recent added friends in facebook then just click the last period.
Here as per chart I can clearly see that I have added a lot of friends in 2009 and 2010. Since that is the
year when I had completed my computer engineering course and most of my time I was spending in
facebook. Quite amazing it does remind my past college life. Power Query along with Power View actually
can tell us story of our own. Happy to find out my past.
This is such a cool tool, Power Query and Power View along with Power BI, You can visualize the things
you just want to see.
17. Page | 16
Power Query Analysis 3 using Power View:
Let’s see your facebook activities from past to present.
This will help you to track down how much time have you spent in facebook and how frequent you post
or update your feed.
This will helps facebook to track down the facebook user usage trend.
How and when user is spending the time in facebook.
Why the facebook user usage trend is decreasing or increasing.
What is the reason behind the feeds data of user is decreasing or increasing.
For the facebook activities analysis, you can use the same feed information worksheet and by creating
new Power View and line chart option you can start analysis of facebook activities from different
perspective.
From graph we can clearly see that there is a huge spike in 200907 to somewhat up to 201003 this is still
because this is the time when I had completed my computer engineering course and most of my time I
was spending in facebook.
Also, going on next year in 201109 there is another spike which is due to that month is my birthday on
04th
September, where there is more feeds regarding my birthday wishes.
18. Page | 17
Now, let’s see the current year facebook activates by using similar Power View and same drag and drop
features and by scroll down to last month date 201405 you can see the trend of your current facebook
activities.
Here from line trend analysis it seems that the facebook activates from past year to current is frequently
decreasing in my case. This is due to that I am spending less time in facebook as compares to previous
year where I use to spend most of my time.
Reference:
http://www.microsoft.com/en-us/powerBI/default.aspx
http://www.slideshare.net/murrayfife/using-microsoft-power-query-to-analyze-facebook-data
http://office.microsoft.com/en-001/excel-help/introduction-to-microsoft-power-query-for-excel-
HA104003940.aspx
19. Page | 18
SUMMARY:
Power Query along with Power View actually can tell us story of your own. This is how Power Query along
with Power View can tell your story by using your own facebook data. Happy to find out my past.
Quite amazing it does remind my past college life.
This is such a cool tool, Power Query and Power View along with Power BI, You can visualize the things
you just want to see.
Also, I am thinking that if facebook provides our friends location data then it will be so easy to find out
the friends and family around the world. Where Power Map will be more useful to track down the friends
whom we have no idea where she or he is but we do connected with facebook in virtual world. If we can
think of creating facebook friends and family location track app which will helps us to find out where exact
is our friends and family are located based on the current location information of facebook data.
20. Page | 19
Anil Maharjan
Highly motivated Business Intelligence Engineer having
leadership abilities and team work skills as well as the
ability to accomplish tasks under minimal direction and
supervision. Has more than 4 years of development &
implementation experience in HealthCare Data
Analytics, Telecommunication Software Industry.
Public speaker in the local SQL Server users group &
community, nominated as local speaker for SQL
Saturday#180 and a program committee member of
Professional Association for SQL Server (PASS) Summit
2014 Program Committee for the ‘BI Platform
Architecture, Development & Administration Team’.
Email: anil_pas@hotmail.com
Twitter: @Anil_Maharjan
LinkedIn: http://np.linkedin.com/in/maharjananil
Personal site: http://maharjananil.com.np
Blog site: http://anilmaharjanonbi.wordpress.com
http://bidn.com/blogs/anil
Slideshare: http://www.slideshare.net/anil_maharjan/presentations