
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create BigQuery Views
/ 50
Create BigQuery Data source
/ 50
Looker Studio helps you to unlock the power of your data through customized data visualizations and reports from a variety of data sources. You can share these visualizations and reports with specific stakeholders or publicly.
In this lab, you learn how to use Looker Studio to visualize data stored in BigQuery using historic information about internal flights in the United States from the US Bureau of Transport Statistics.
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
This lab uses a dataset, code samples, and scripts developed for Data Science on the Google Cloud Platform, 2nd Edition from O'Reilly Media, Inc. and covers the data visualization tasks covered in Chapter 3, "Creating Compelling Dashboards".
This lab uses a BigQuery dataset that has been pre-loaded with two months of sample flight data for January and February 2015, which was obtained from the US Bureau of Transport Statistics. The flight data is in a table called flights_raw
in the dsongcp
dataset.
In the Cloud Console, expand the Navigation menu () and select BigQuery.
In the Explorer panel on the left, expand your project and dsongcp
dataset, then select the flights_raw
table.
On the right side of the window, select the Schema tab to see the schema of the flights_raw
table.
For a quick look at a BigQuery table, use the Preview functionality.
flights_raw
table.Create some table views to easily see flights that are delayed by 10, 15 and 20 minutes respectively. You'll use these views later in the lab.
./create_views.sh
:In a new browser tab, open Looker Studio.
If needed, click Use it for free.
Click Data sources in the top menu.
On the top left, click + Create > Data source.
Select a Country and provide a Company name.
Agree to the Terms of service and click Continue.
Select No for all email preferences, then click Continue.
In the list of Google Connectors, click the BigQuery tile.
Click AUTHORIZE to enable access from Looker Studio to your Cloud sources.
If needed, be sure your lab account is selected, click ALLOW.
Click to select MY PROJECTS > [Project-ID]
> dsongcp > flights.
Click the blue CONNECT button on the upper right of the screen.
Click CREATE REPORT at the top right of the page.
Click ADD TO REPORT to confirm that you want to add the flights
table as a data source.
Replace Untitled Report in the top left with your name for this report.
Since you'll create your own charts, click to select, then delete the automatically created chart.
Click Add a chart > Scatter chart, then draw a rectangle on the report canvas to hold the chart.
In the right panel, the DATA tab lists the data properties.
Field | Value |
---|---|
Dimension |
UNIQUE CARRIER |
Metric X |
DEP_DELAY |
Metric Y |
ARR_DELAY |
Change the aggregation type to Average.
Click outside the aggregation type box to return to the property pane.
Do the same for Metric Y to change the aggregation type from SUM to Average.
Click the STYLE tab.
In the Style menu click the Trendline drop-down and select Linear.
In the ribbon above the report, click Add a control > Date range control.
Try it out!
Click Edit on the upper right to add more chart items.
Click Add a chart > Pie chart, then draw a rectangle on the report canvas to hold the pie chart.
With the pie chart selected, click ADD A FIELD on the bottom right of the Data tab in the right panel.
ADD A FIELD
option, refresh your browser tab.
Click Add calculated field to view the field property summary.
Click ALL FIELDS to view the field property summary.
Click the context menu icon to the right of the ARR_DELAY
field (three dots) and select Duplicate.
Click + ADD A FIELD on the top right of the section.
Click Add calculated field and name the field is_late
.
In the Formula text box enter the following formula:
The field name must register correctly. If you do not see the syntax highlighting as shown below, double check the formula or use the Available Fields selector on the right to select the Copy of ARR_DELAY field.
Click SAVE and then click DONE.
In the DATA tab in the right panel, change the Dimension for the Pie chart to the new is_late calculated field.
Change the Metric to the new is_late field.
Hover over the CTD icon next the is_late metric.
Click it and change the aggregation to Count.
The pie chart now displays the percentage of on time and late flights.
Click Add a chart > Column chart, and then draw a rectangle on the report canvas to hold the bar chart.
In the DATA tab, click the field for the settings below and change to the following:
Field | Value |
---|---|
Dimension |
UNIQUE CARRIER |
Metric 1 (Default) |
DEP_DELAY |
Metric 2 (click Add metric) |
ARR_DELAY |
Sort |
UNIQUE CARRIER |
Sort Order |
Ascending |
You've created 3 database table views. Now create charts to display the delay thresholds for these tables.
Select the second pie chart and click flights in the Data Source in the property list.
Click + ADD DATA at the bottom of the menu.
Click BigQuery in the Google Connectors section of the selection pane.
Select MY PROJECTS > [Project-ID]
> dsongcp.
Click the delayed_10 table to select it and then click ADD button on the bottom right of the screen.
Click + ADD A FIELD on the bottom right of the screen. You may need to make sure you have selected the DATA property tab on the right hand side of the screen to see this.
Click Add calculated field to view the field property summary.
If you cannot see the full list of fields with their data type and Aggregation type displayed then click ALL FIELDS to go to the field property summary.
Click the context menu icon to the right of the ARR_DELAY
field and select Duplicate.
Click + ADD A FIELD on the right side of the screen for the delayed_10 data source.
Enter is_late
in the Field Name text box.
Enter the following formula in the Formula text box:
The field name must register correctly. If you do not see the syntax highlighting as shown below then double check the formula or use the Available Fields selector on the right to select the Copy of ARR_DELAY field.
Click SAVE and then click DONE.
Now change the Data Source for the new pie chart to delayed_10
. It should retain the is_late calculated field.
The second pie chart now displays the percentage of on time and late flights for the Delayed_10
view.
Optionally repeat the last two sections, where you added an additional database view for the Delayed_15 and Delayed_20 views.
You used Looker Studio to visualize data stored in BigQuery tables and views.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated June 26, 2024
Lab Last Tested March 08, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one