11/4/2015
T ut utor ia ial : F ac acebook anal yt yti cs cs usi ng ng Pow er er BI D es esktop – M ic icr os osoft Pow er er BI
Microsoft Power BI Support Support Get help and support for Power BI
Tutorial: Facebook analytics using Power Po wer BI Desktop ← Power BI Desktop (/knowledgebase/topics/68530-power-bi-desk (/knowledgebase/topics/68530-power-bi-desktop) top)
Sign up for Power BI Get Get started using
In this tutorial you learn how to import and visualize data from Facebook Facebook.. During the tutorial you'll learn how to connect to a specific Facebook page (the Power BI page), apply data transformation steps, and create some visualizations.
Power BI today and begin creating insightful, interactive
Here are the steps you'll take: Task 1: Connect 1: Connect to a Facebook Page Task 2: 2: Create visualizations using the Report view
dashboards within minutes. New and returning users may sign in (/signin)
Sign up
Step 1: 1: Create a Treemap visualization visualiz ation Task 3: 3: Shape data in the Query view Step 1: 1: Split the date-time column into two Step 2: 2: Add an aggregate value from a related table Task 4: 4: Create additional visualizations using the Report view Step 1: 1: Load the query to your report Step 2: 2: Create a Line chart and a Bar chart
Task 1: Connect to a Facebook page In this task you import data from the Microsoft Power BI Facebook (https://www.facebook.com/microsoftbi)site (here's the URL: https://www.facebook.com/microsoftbi ). ). Anyone can c an connect to that page, and follow these steps - no special credentials (other than your own Facebook account, which you use in this step) are required. https:/ s://sup support. rt.powerb werbi. i.co com/ m/kn kno owled wledgebase/ se/artic rticle les/ s/4 461312-tu -tutorial-f rial-fa aceb cebook-a k-analyt lyticsics-u usin sing-po -power-b wer-bi-d i-de eskt skto
Power BI Desktop (/knowledgebase/topics/6853 power-bi-desktop) Power BI Desktop Help (/knowledgebase/articles/567183power-bi-desktop-help) What's new in the latest Power BI Desktop update? (/knowledgebase/articles/489224what-s-new-in-the-latest-powerbi-desktop-update) Get Power BI Desktop (/knowledgebase/articles/464158get-power-bi-desktop) Getting started with Power BI Desktop (/knowledgebase/articles/471664getting-started-with-power-bidesktop) Power BI Desktop videos (/knowledgebase/articles/461292power-bi-desktop-videos) Import Excel workbooks into Power BI Desktop (/knowledgebase/articles/703422import-excel-workbooks-intopower-bi-desktop) 1/22
11/4/2015
T ut utor ia ial : F ac acebook anal yt yti cs cs usi ng ng Pow er er BI D es esktop – M ic icr os osoft Pow er er BI
Connect to data in Power BI Desktop (/knowledgebase/articles/471635connect-to-data-in-power-bidesktop) Data sources in Power BI Desktop (/knowledgebase/articles/471643data-sources-in-power-bidesktop) Use DirectQuery in Power BI Desktop (Preview Feature) (/knowledgebase/articles/755139use-directquery-in-power-bidesktop-preview-featu) Analysis Services Tabular data in Power BI Desktop (/knowledgebase/articles/665278analysis-services-tabular-data-inpower-bi-desktop)
1. In the Getting Started dialog Started dialog or in the Home ribbon tab, tab, select Get Data. 2. The Get Data dialog Data dialog appears, letting you select from all sorts of data sources. Select Facebook from Facebook from the Other group. group.
Report View in Power BI Desktop (/knowledgebase/articles/461283report-view-in-power-bi-desktop) Tips and tricks for creating reports in Power BI Desktop (/knowledgebase/articles/464157tips-and-tricks-for-creatingreports-in-power-bi-d) Publish from Power BI Desktop (/knowledgebase/articles/461278publish-from-power-bi-desktop) Query overview in Power BI Desktop (/knowledgebase/articles/471646query-overview-in-power-bidesktop) Shape and combine data in Power BI Desktop (/knowledgebase/articles/471644shape-and-combine-data-inpower-bi-desktop) Common query tasks in Power BI Desktop (/knowledgebase/articles/471648common-query-tasks-in-power-bidesktop) Tutorial: Tutorial: Analyzing sales data from Excel and an OData feed (/knowledgebase/articles/471597tutorial-analyzing-sales-datafrom-excel-and-an-o) Data View in Power BI Desktop (/knowledgebase/articles/663202data-view-in-power-bi-desktop) Relationship View in Power BI Desktop (/knowledgebase/articles/663229relationship-view-in-power-bidesktop) Create and manage relationships in Power BI Desktop (/knowledgebase/articles/464155create-and-managerelationships-in-power-bi-deskto)
https:/ s://sup support. rt.powerb werbi. i.co com/ m/kn kno owled wledgebase/ se/artic rticle les/ s/4 461312-tu -tutorial-f rial-fa aceb cebook-a k-analyt lyticsics-u usin sing-po -power-b wer-bi-d i-de eskt skto
2/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
When you select Connect, a dialog appears to alert you to the risks of using a third-party service.
Calculated columns in Power BI Desktop (/knowledgebase/articles/590598calculated-columns-in-power-bidesktop) Measures in Power BI Desktop (/knowledgebase/articles/554577measures-in-power-bi-desktop) Data types in Power BI Desktop (/knowledgebase/articles/558030data-types-in-power-bi-desktop) Data categorization in Power BI Desktop (/knowledgebase/articles/594282data-categorization-in-power-bidesktop)
3. When you select Continue, the Facebook dialog box appears where you can paste the page name (microsoftbi) into the Username text box. Select Posts from the Connection drop down.
Sort by column in Power BI Desktop (/knowledgebase/articles/592116sort-by-column-in-power-bidesktop) Calculated tables in Power BI Desktop (/knowledgebase/articles/741510calculated-tables-in-power-bidesktop) Tutorial: Importing and analyzing data from a Web Page using Power BI Desktop (/knowledgebase/articles/461315tutorial-importing-and-analyzingdata-from-a-web)
4. Click OK. 5. When prompted for credentials, sign in using your Facebook account and allow Power BI access through your account.
DAX basics in Power BI Desktop (/knowledgebase/articles/554619dax-basics-in-power-bi-desktop) Tutorial: Facebook analytics using Power BI Desktop (/knowledgebase/articles/46131 2-tutorial-facebook-analyticsusing-power-bi-deskto) Tutorial: Create your own measures in Power BI Desktop (/knowledgebase/articles/556656tutorial-create-your-ownmeasures-in-power-bi-des) Tutorial: Create calculated columns in Power BI Desktop (/knowledgebase/articles/590610tutorial-create-calculatedcolumns-in-power-bi-de)
After establishing a connection to the page, you will see the data being loaded in the model.
Third-party service: Google Analytics connector for Pow er BI Desktop (/knowledgebase/articles/591699third-party-service-googleanalytics-connector-fo) Third-party service: Facebook connector for Power BI Desktop (/knowledgebase/articles/571845third-party-service-facebookconnector-for-power) Project Online: connect to data through Power BI Desktop
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
3/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
(/knowledgebase/articles/495096project-online-connect-to-datathrough-power-bi-d) Import and display KPIs (Preview) (/knowledgebase/articles/751896import-and-display-kpis-preview) Pyramid Analytics (/knowledgebase/articles/729417pyramid-analytics)
Search
Contact support (https://support.powerb
From there, Query Editor displays the data. Query Editor is part of Power BI Desktop, but loads in a separate window, and is where you perform all your transformations on your data connections.
Give feedback (/forums/265200power-bi) BI in SQL vNext (/forums/282523bi-in-sql-vnext) 178 Developer APIs (/forums/268152developer-apis) 45 Power BI (/forums/265200-powerbi) 1,824
Knowledge Base (/knowledgebase) Getting started (/knowledgebase/topics/63037getting-started) 17 Get data (/knowledgebase/topics/63369get-data) 11 Files in Power BI (/knowledgebase/topics/88767files-in-power-bi) 7 Services in Power BI (/knowledgebase/topics/88770services-in-power-bi) 31
When your data is how you want it, you can load it into Power BI Desktop. Select Load & Close from the Home ribbon.
Databases and more (/knowledgebase/topics/88773databases-and-more) 6 Data refresh (/knowledgebase/topics/107925data-refresh) 9 All about dashboards (/knowledgebase/topics/65158all-about-dashboards) 14 All about reports (/knowledgebase/topics/65157all-about-reports) 19
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
4/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Visualizations in reports (/knowledgebase/topics/65160visualizations-in-reports) 29 Q&A in Power BI (/knowledgebase/topics/70394-qa-in-power-bi) 6 Groups in Power BI (/knowledgebase/topics/101158groups-in-power-bi) 5 Power BI Desktop (/knowledgebase/topics/68530power-bi-desktop) 36 Mobile apps for Power BI (/knowledgebase/topics/72969mobile-apps-for-power-bi) 1 iPad app (Power BI for iOS) (/knowledgebase/topics/77999ipad-app-power-bi-for-ios) 10 iPhone app (Power BI for iOS) (/knowledgebase/topics/78002iphone-app-power-bi-for-ios) 9
You'll see a dialog that displays the progress of loading the data into the Power BI Desktop data model.
Power BI app for Windows (/knowledgebase/topics/75729power-bi-app-for-windows) 9 Power BI app for Android phones (/knowledgebase/topics/85887power-bi-app-for-androidphones) 8 Administrative (/knowledgebase/topics/63248administrative) 9 Troubleshooting (/knowledgebase/topics/65779troubleshooting) 11 Samples (/knowledgebase/topics/75672samples) 11
Once loaded, you’ll be taken to the Report view where the columns from the table are listed in the Field list on the right.
Top issues and questions (/knowledgebase/topics/106950top-issues-and-questions) 4 All articles (/knowledgebase/articles/all)
(http://aka.ms/gettingstartedpowerbi) https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
5/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Task 2: Create visualizations using the Report view Now that you have landed the data from the page, you can quickly and easily gain insights about your data, using visualizations. Step 1: Create a Treemap visualization Creating a visualization is easy, we just drag a field from the Field list and drop it on the Report canvas. Drag the type field onto the Report canvas. Power BI Desktop creates a new visualization in the Report canvas. Next, drag type from Fields (the same field you just dragged onto the Report canvas) onto the Value area to create a Bar visualization.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
6/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
We can easily change the type of visualization by selecting a different icon from the Visualization pane. Let's change the type to a Treemap by selecting its icon from Visualizations, as shown in the following image.
Next, let's add a legend, then change the color of a data point. Select the Format icon in the Visualizations pane; the Format icon looks like a paintbrush. https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
7/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
When you select the down arrow next to Legend, the section expands to show how to customize the legend for the selected visualization. In this case, we made the following selections: moved the Legend slider to On so a legend would appear selected Right from the Legend Position drop-down moved the Title slider to On as well, so a title for the legend will appear typed in type for the title of the legend In the following image, those settings are already made and reflected in the visualization.
Next, let's change the color of one of the data points. The link data point should be blue, so it's closer to the common color for hyperlinks. Select the arrow next to Data Colors to expand that section. The data points are shown, with selection arrows beside each color that allows us to select a different color for each data point. https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
8/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
When you click on the color box down arrow beside any data point, a color selection dialog appears, letting you choose your color. In this case, we'll choose light blue.
That's better. In the following image, you can see how the color is applied to the data point in the visualization, and that the legend is also automatically updated, as is its color in the Data Colors section.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
9/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Task 3: Shape data in the table Now that you have imported the table selected and you start to visualize it, you may notice you need to perform various data shaping and cleansing steps in order to get the most out of your data. Step 1: Split the date-time column into two In this step, you will split the created_time column to get both the date and time values. Whenever you're in Power BI Desktop and you want to modify an existing query, you need to launch Query Editor . To do that, select Edit Queries from the Home tab.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
10/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
1. In the Query Editor grid, scroll to the right until you find the created_time column 2. Right-click a column header in the Query Preview grid, and click Split Column > By Delimiter to split the columns. Chose Custom in the delimiter drop down and enter “T” Note that this operation is also available in the Home ribbon tab, in the Manage Columns group.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
11/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
3. Rename the created columns to created_date and created_time respectively. 4. Select the new column, created_time, and in the Query view ribbon, navigate to the Add Column tab and select Time>Hour under the From Date & Time group. This will add a new column that is only the hour component of the time.
5. Change the type of the new Hour column to Whole Number , by navigating to the Home tab and selecting the Data Type drop down or by right-clicking the column and selecting Transform>Whole Number .
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
12/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Step 2: Add an aggregate value from a related table In this step, you add the count of shares from the nested value so that you can use it in the visualizations. 1. Continue scrolling to the right until you see the shares column. The nested value indicates that we need to do another transform in order to get the actual values. 2. In the top right of the column header, select the icon to open the Expand/Aggregate builder. Select count and hit OK. This will add the count of the shares for each row in our table.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
13/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
After the data loads, rename the column to shares by double clicking on the column name, right clicking the column or in the Query view ribbon, select Rename under the Transform tab and Any Column group. 4. Finally, change the type of the new shares column to Whole Number . With the column selected, the type can be changed by right-clicking the column and selecting Transform>Whole Number or by navigating to the Home tab and selecting the Data Type drop down or.
Query steps created As you perform transformations in the Query view, query steps are created and listed in the Query Settings pane, in the APPLIED STEPS list. Each query step has a corresponding Query formula, also known as the "M" language.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
14/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Task
Query step
Formula
Connect to a Facebook source
Source
Facebook.Graph
Split Columns to get the values you need
Split Column by Delimiter
("https://graph.facebook.com/microsoftbi/posts")
Table.SplitColumn (Source,"created_time",Splitter.SplitTextByDelimiter("T"), {"created_time.1", "created_time.2"})
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
15/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Change Type of the new columns (automatic step)
Changed Type
Rename a column
Renamed Columns
Table.TransformColumnTypes (#"Split Column by Delimiter",{{"created_time.1", type date}, {"created_time.2", type time}})
Table.RenameColumns (#"Changed Type",{{"created_time.1", "created_date"}, {"created_time.2", "created_time"}})
Insert a column
Inserted Hour
Table.AddColumn (#"Renamed Columns", "Hour", each Time.Hour([created_time]), type number)
Change Type
Changed Type1
Table.TransformColumnTypes (#"Inserted Hour",{{"Hour", type text}})
Expand values in a nested table
Expand shares
Rename the column
Renamed Columns1
Change Type
Changed Type2
Table.ExpandRecordColumn (#"Changed Type1", "shares", {"count"}, {"shares.count"})
Table.RenameColumns (#" Expand shares",{{"shares.count", "shares"}})
Table.TransformColumnTypes (#"Renamed Columns1",{{"shares", Int64.Type}})
Task 4: Create additional visualizations using the Report view Now that we have converted the data into the shape that we need for the rest of our analysis, we can load the resulting table into our Report and create additional visualizations. Step 1: Load the query to your report
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
16/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
In order to load the query results to the report, we need to select Load & Close from Query Editor . This will load our changes into Power BI Desktop, and close Query Editor .
In Power BI Desktop, we need to make sure we're in Report view. Select the top icon from the left bar in Power BI Desktop.
Step 2: Create a Line chart and a Bar chart In order to create a visualization, we can drag fields from the Field list and drop them in the Report canvas. 1. Drag the shares field onto the Report canvas, which creates a bar chart. Then drag created_date onto the chart, and Power BI Desktop changes the visualization to a Line Chart.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
17/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
2. Next, drag the shares field and drop it in the Report canvas. Now drag the Hour field into the Axis section under the Field List.
3. We can easily change the type of visualization by clicking on a different icon in the Visualization pane. The arrow in the image below points to the Bar Chart icon.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
18/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
4. Change the visualization type to Bar Chart. 5. The Bar Chart is created, but the axis isn't what we want - we want it sorted in the other direction (from high to low). Select the down arrow next to Y-Axis to expand that section. We need to change the type of axis from Continuous to Categorical, so it'll sort how we want it (the image below shows the axis before we make the selection - check out the subsequent image for how we want it to look).
That's better. And now we have three visualizations on this page, which we can size as we want to fill up the report page.
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
19/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
As you can see, it's easy to customize visualizations in your report, so you can present the data in the way that you want. Power BI Desktop provides a seamless end-to-end experience from getting data from a wide range of data sources and shaping it to meet your analysis needs to visualizing this data in rich and interactive ways. Once your report is ready, you can upload it to Power BI (http://support.powerbi.com/knowledgebase/articles/461278upload-power-bi-designer-files) and create dashboards based on it, which you can share with other Power BI users. You can download the end result of this tutorial here (http://download.microsoft.com/download/1/4/E/14EDED28-6C58-4055 A65C-23B4DA81C4DE/FacebookAnalytics.pbix)
Where else can I get more information? Read other Power BI Desktop tutorials (http://go.microsoft.com/fwlink/? LinkID=521937). Watch Power BI Desktop videos. (http://go.microsoft.com/fwlink/? LinkID=519322) Visit the Power BI Forum. (http://go.microsoft.com/fwlink/?LinkID=519326) Read the Power BI Blog. (http://go.microsoft.com/fwlink/?LinkID=519327)
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
20/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI
Was this information helpful?
Yes
No
Sign up for Power BI Sign up for free or become a Pro User for even more storage and features.
Use it free
Enter your work email address
By clicking Use it free, you agree to the Power BI Preview Terms of Service /terms‐of‐service
Sign up Insights are hiding in your company's data ‐ see the impact of bringing them into focus with Power BI.
Use it free
Enter your work email address By clicking Use it free, you agree to the Power BI Terms of Service /terms‐of‐service
Downloads Whether you are on the go or need to create rich,
POWER BI DESKTOP
interactive reports, Power BI offers you the tools you
(HTTPS://POWERBI.MICROSOFT.COM/DESKTOP)
need. https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
21/22
11/4/2015
T utor ial : F acebook anal yti cs usi ng Pow er BI D esktop – M icr osoft Pow er BI MOBILE (HTTPS://POWERBI.MICROSOFT.COM/MOBILE) SEE ALL DOWNLOADS (HTTPS://POWERBI.MICROSOFT.COM/DOWNLOADS)
Legal
Information
PRIVACY & COOKIES
SUPPORT (HTTPS://SUPPORT.POWERBI.COM/)
(HTTP://GO.MICROSOFT.COM/FWLINK/?LINKID=248681) TERMS OF USE (HTTPS://WWW.MICROSOFT.COM/EN-
DEVELOPERS (HTTPS://POWERBI.MICROSOFT.COM/DEVELOPERS)
US/LEGAL/INTELLECTUALPROPERTY/COPYRIGHT/DEFAULT.ASPX) BLOG (HTTP://WWW.MICROSOFT.COM/ENTRADEMARKS (HTTP://GO.MICROSOFT.COM/? LINKID=9851308)
US/POWERBI/BI-BLOG.ASPX) NEWSLETTER (HTTPS://POWERBI.MICROSOFT.COM/NEWSLETTER)
Designed and built by the Power BI Design Studio (https://powerbi.microsoft.com/studio)
(https://twitter.com/MSPowerBI) (https://www.facebook.com/microsoftbi?fref=ts) (https://www.youtube.com/c/mspowerbi)
https://support.powerbi.com/knowledgebase/articles/461312-tutorial-facebook-analytics-using-power-bi-deskto
22/22