Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Krunalbpatel
Helper III
Helper III

How to get twitter followers for particular user

Hi,

 

I am preparing Power BI report for getting Twitter follwers. I want to display report for particular users all the followers, followers count and following count and so on.

 

I am found the following link https://chris.koester.io/index.php/2015/07/16/get-data-from-twitter-api-with-power-query/

In this link I am not able to get the particular user data. This will find the tweets on the twitter account.

 

Can you please help me to get the particular user data. Is it possible to get the data using power query(api)?

1 ACCEPTED SOLUTION

Hi @ImkeF,

 

I got the solution. Using the following Api call https://api.twitter.com/1.1/users/show.json?user_id=123456 I am getting the required detail then I have translated the json data(Return result from the API call) into table. The table represent each row as all information so I use Pivot table so It gives me  the required result.

 

#"Converted to Table" = Record.ToTable(FormatAsJsonQuery),
#"Pivoted Column" = Table.Pivot(#"Capitalized Each Word", List.Distinct(#"Converted to Table"[Name]), "Name", "Value")

 

Using the above code snippet I got my required result.

 

View solution in original post

5 REPLIES 5
v-yuezhe-msft
Employee
Employee

Hi @Krunalbpatel,

You would need to firstly export data about followers in Excel, then import data from Excel to Power BI Desktop and create relevant reports.

 

Please follow the instructions in the similar blogs below to calculate Twitter followers and create Twitter reports in Power BI Desktop.

Counting Overlapping/Shared Twitter, Facebook, Instagram, etc. Followers
Import Twitter data to Excel & Power BI using Microsoft Flow or Zapier


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yuezhe-msft,

 

I have got the twitter user detail using the API. Here is the API call to get the particular user data.

 

https://api.twitter.com/1.1/users/show.json?user_id=123456

 

Using the above API call I am getting the required detail also. But Now problem is that I am not able to getting the result in a single record. I am getting the result in a record format. So I am getting only 2 column as a result. And each value as a record.

Hi @Krunalbpatel,

the URL you've given returns a lot of data, but I cannot spot a record where followers are returned (just the total number of them).

Could you please give more details about the record in question?

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi @ImkeF,

 

I got the solution. Using the following Api call https://api.twitter.com/1.1/users/show.json?user_id=123456 I am getting the required detail then I have translated the json data(Return result from the API call) into table. The table represent each row as all information so I use Pivot table so It gives me  the required result.

 

#"Converted to Table" = Record.ToTable(FormatAsJsonQuery),
#"Pivoted Column" = Table.Pivot(#"Capitalized Each Word", List.Distinct(#"Converted to Table"[Name]), "Name", "Value")

 

Using the above code snippet I got my required result.

 

Hi @Krunalbpatel,

now I see what you're after. That's a couple of unnecessary steps here, that will cost performance.

An easier and faster way would be this:

 

Table.FromRecords({FormatAsJsonQuery})

! watch the curly brackets ! 

 

If you just want to retrieve the number of followers, you even don't have to perform this step, just put the name of the field you're after into square brackets like this:

 

FormatAsJsonQuery[followers_count]

 

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors