cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Facebook Page Likes

Hi everyone,

 

I am building a dashboard for my Company's marketing department. So far, I have been able to load all of the data related to our page's "Posts" using the Get Data wizard with Facebook as the source.

 

I cannot figure out how to pull the data of those accounts that "like" our page. When I use the Get Data wizard and choose Facebook as the source, it lists "Likes" as a connection option. When I choose this data, it imports the accounts that our Company Facebook page likes, not those who like us. 

 

Is there any way to pull those accounts who like our page using PowerBI?

 

Thanks!

1 ACCEPTED SOLUTION

I believe this is explicitly prevented by Facebook for either privacy and/or corporate IP purposes



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

30 REPLIES 30

You can get the number of likes by manipulating the Facebook Graph API URL in the Query formula to call for the [page]/insights/page_fans metric.

 

Here is an example (modify the page name which is highlighted in bold)

 

 

let
    Source = Facebook.Graph("https://graph.facebook.com/v2.2/datachantblog/insights/page_fans"),
    #"Removed Other Columns" = Table.SelectColumns(Source,{"values"}),
    #"Expanded values" = Table.ExpandTableColumn(#"Removed Other Columns", "values", {"value", "end_time"}, {"value", "end_time"})
in
    #"Expanded values"

If you are considering a rebust Facebook dashboard with Power BI, you can learn some cool tips and tricks in my blog.

Feel free to contact me if you have any further questions.

Hello @DataChant,

 

I tried to apply the solution that you indicated, but this one has an authentication error and is already authenticated, what can I do?

 

pb3.png

I had the same problemn. You should to logout to Facebook, then login again. Get new token and use it on Power BI.

It appears tis ain't working anymore. 

 

I copy-pasted the code below, but that gave some errors on the "values" column (does that mean it finds something?). When "Removed Other Colums" and "Expanded Values" were removed though, it just keeps waiting for graph.facebook.com. 

 

Any thoughts? I tried updating the API version number but no result. 

I confirm that this is not working anymore. Calls to the Facebook API metrics /insights/* just hang forever "waiting for graph.facebook.com". Something must be broken with the PowerBI Facebook connector. Can anyone help?

The best way to get Facebook data at this stage is to use the Web Connector. You can follow my blog http://datachant.com for many examples.

What about page likes without knowing who liked your page. How do you get that?

Here is an example with Web.Contents to get your Facebook Likes:

 

let
YourFacebookObjectName = "datachantblog",
YourAccessToken = "Get the token from Facebook Graph Explorer, or APIGEE", Source = Json.Document(Web.Contents("https://graph.facebook.com/v2.7/" & YourFacebookObjectName & "/insights/page_fans?access_token=" & YourAccessToken)), data = Source[data], #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"values"}, {"values"}), #"Expanded values" = Table.ExpandListColumn(#"Expanded Column1", "values"), #"Expanded values1" = Table.ExpandRecordColumn(#"Expanded values", "values", {"value", "end_time"}, {"value", "end_time"}) in #"Expanded values1"

 

Hi @DataChant,

 

I've tried to do what you just described, but I have an error: Column1 has not been found...

Do you know why ?

 

Thanks !!

 

Can you please share the M expression?

Facebook made some changes recently, and you cannot use the Facebook connector to read user likes.

Hello @DataChant, could you help me with something?

I would like to get the data from page fans like:
date                 page_fan_add
01/02/2019      12 
02/02/2019      15
...

And I'm getting the data by Web.Contentes as you can see below:
let
                     Fonte = Json.Document(Web.Contents(
                                 "https://graph.facebook.com/v3.2/2079445882318439?                                          fields=name%2Cfan_count%2Clink%2Cusername%2Cposts&access_token=%...%"))
in
                     Fonte

I found this "page_fan_adds_by_paid_non_paid_unique" at the documentation but I don't know how and if I can use it at the URL, do you know something about it? Can I use it?

Best Regards,
Diego S. Lutckmeier

@DataChant
Of course, 

 

let
Source = Facebook.Graph("https://graph.facebook.com/v2.2/rgmtecnologia/insights/page_fans"),
#"Removed Other Columns" = Table.SelectColumns(Source,{"values"}),
#"Expanded values" = Table.ExpandTableColumn(#"Removed Other Columns", "values", {"value", "end_time"}, {"value", "end_time"})
in
#"Expanded values"

 

 

I can no longer read the tanned of the users? Is there another way to get this information for power bi?

 

 

Thanks for your help.

Hi @vitexo87
You cannot read insights any longer using the Facebook connector. If you are an admin of the page you can still do it using Web.Contents, but you will need to get a page access token, which are challenging to get if you are not developer. Will you be satisfied with a report that requires contact manual update to the access token?

Good morning! What do you mean by "web.contents"? I'm facing the same problem but can't figure it out.

 

Thanks!

Anonymous
Not applicable

Hi,

 

I too have this error.

 

Thanks

Thanks. I played around in the Graph API Explorer and found 'fan_count'. The following seems to do the trick.

= Facebook.Graph("https://graph.facebook.com/v2.7/pagename?fields=fan_count") 

How do I combine this with dates, so that I can show page likes growth over time?

 

Engagenment also works, but again I don't know how to combine this with a date.

= Facebook.Graph("https://graph.facebook.com/v2.7/pagename?fields=engagement") 

Procyon82, try to use the field since as a parameter in the URL. More details here.

 

I tried that using unix timestamp, but it just gives me today's total page likes. How do others answer questions regarding page like growth? It can't be that hard...

Did you try using the Web connector and Insights/page_fans directly?

As in using https://www.facebook.com/XXX/insights/page_fans_count ? It tells me not a valid URL.

Helpful resources

Announcements
secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors