Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I work in media and was wondering how I would be able to import Facebook data and be able to get the likes, comments and shares count for individual page posts.
Have also tried this in power query in Excel 2016 but there seems to be a bit of a learning curve and I can't figure it out. Any help would be appreciated.
Thanks 🙂
Thanks @vasim07 that's what I suspected it was - good to have someone else with more expertise confirm this. However, I guess the main problem is the aggregation part - seems to rely heavily on the FB graph which is very very slow - guess there isn't a faster way to do this?
@itchyeyeballs your problem is because the page you are trying to call from has too many posts - and I would guess that Facebook has a limitation as to how much data you can call in a single query.
Here's what I've done as a workaround - first of all when you pick what kind of data you'd like to get from Facebook, pick 'Statuses' instead of 'Posts'. Usually that does the trick and you'll be able to get some data first. Then once the window pops up you click "Edit".
Clicking edit will bring up the query. You then select "Advanced Editor" in which a pop up will appear with some code. Change to the following format:
This is the original format:
let
Source = Facebook.Graph("https://graph.facebook.com/v2.2/PAGENAMEHERE/statuses")
in
Source
--------
Now the changes you have to make:
1. Change 'statuses' at the end to 'posts' - because you want posts.
2. You will need to set a limit as to how much data you are pulling from Facebook, so add the following after statuses: ?limit=100
The number 100 is quite arbitrary but basically adjust it until you are able to pull data.
Looks like this:
let
Source = Facebook.Graph("https://graph.facebook.com/v2.2/PAGENAMEHERE/statuses?limit=100")
in
Source
If you wish, you can even set some date parameters so the system will only pull in posts with the limit and between the dates you set:
let
Source = Facebook.Graph("https://graph.facebook.com/v2.2/PAGENAMEHERE/statuses?limit=100&since=2012-10-20&until=2012-12-31")
in
Source
This should solve your problem with the errors.
Meanwhile I'm still waiting for the FB graph to finish aggregating..sigh..there's got to be a better and faster way..
I got it to run in the end although its a bit flakey and falls over alot, refreshing the query seems to do the trick but thanks for the suggested workaround.
The number of posts in the page I'm looking at was only about 800 which doesn't seem a lot, asside from the unexpected error I also sometimes get an error asking me to reduce amount of data requested, again a refresh resolves.
The whole process It is very slow but I guess thats how facebook want it. Things seem to have improved a bit now its no longer lunch time, I guess FB throttle the API at busy times.
Yeah - still trying to justify the value of doing this. At the very least this query is able to populate all the posts easily so if I were to do it by hand that already saves a bit of the work.
It is automation, but a very slow one at that. I was hoping for a faster way. Oh well - maybe we'll see better solutions down the road.
What do you mean by the FaceBook fields in the Power BI such as:
Caption
Id
Description
created_time
Icon
Is_expired
Is_hidden
Link
Message
Name
Object_id
Picture
Source
Status_type
Story
Type
Updated_time
?
I cannot find any information in the internet. Help me please.
@vasim07 - good stuff solves the issue I was having.
New problem for me is that trying to import data for entities with larger amounts of data causes an unexpected error, for example MicrosoftBI works but MicrosoftUK doesn't
Thanks for the help both - but it still doesn't solve the problem.
SharedCount is for external webpages - not for posts within the Facebook platform.
Again I'm looking for just a number count of the Likes, comments and shares so I can pull up some quick competitor analysis without having to do everything by hand.
Anyone else who knows how to do this please let me know, thanks 🙂
Hi @rc225225,
I was actually analysing facebook data from our company site when I read your post 🙂
1. Within PowerBI Desktop, click on Get Data
2. Scroll down and select 'Facebook'
3. A message will pop up warning you that you will access a 3rd party site. Just click on 'continue'
4. For the username, enter the name of the Facebook Page. For instance, Microsoft's Facebook page is 'www.facebook.com/Microsoft'. The name in this instance is 'Microsoft'
5. Under connection, select 'Posts'.
6. You will be asked to enter your credentials, which is your actual Facebook login details.
I was analysing comments and posts. I'm not sure if Likes are available.
Cheers,
Daniel
Thanks for your help - what I was looking for is not necessarily the posts, but just the data.
eg. Post 1 may have 100 likes, 25 shares and 56 comments.
I would then take the total of these and divide it by a certain percentage of the fanbase to get an overall feel for how competitor content performs.
Following the tutorial here - https://powerbi.microsoft.com/en-us/documentation/powerbi-desktop-tutorial-facebook-analytics/
I can only figure out how to pick up likes or comments from a single specified entity (all comments made by one user for example), there doesn't seem to be a way to pick up all likes on specific pages or posts.
I've probably missed something but It looks like you will have to manually utilise the insights element of the graph API - https://developers.facebook.com/docs/graph-api/reference/v2.5/insights or purchase a third party solution
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
104 | |
95 | |
80 | |
67 | |
62 |
User | Count |
---|---|
147 | |
109 | |
107 | |
85 | |
63 |