
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 new dimensions
/ 30
Create the measures
/ 40
Create the advanced measures
/ 30
Looker is a modern data platform in Google Cloud that lets you analyze and visualize your data interactively. You can use Looker to do in-depth data analysis, integrate insights across different data sources, build actionable data-driven workflows, and create custom data applications.
In Looker, dimensions are unique attributes of the data that help you to describe data. For example, the city and elevation of an airport may be different dimensions within an airport dataset. Measures are aggregations of one or more dimensions (or unique attributes of the data) such as a count or average. Measures let you calculate your Key Performance Indicators (KPIs) and help your business users analyze data using different aggregated attributes.
In this lab, you learn how to create different types of dimensions and measures in LookML as a Looker developer. You also learn how to modify models of Explores, which are data views that serve as the foundation for self-service exploration by the business users in Looker.
For this lab, a project called qwiklabs-ecommerce
has been created for you in LookML. This project is based on a mock e-commerce dataset that will enable you to create business KPIs using dimensions and measures created using LookML. You can learn more about LookML modeling in the Looker documentation.
In this lab, you learn how to:
qwiklabs-ecommerce
) published by a Looker admin.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 are 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:
When ready, click Start Lab.
The Lab Details pane appears with the temporary credentials that you must use for this lab.
If you need to pay for the lab, a pop-up opens for you to select your payment method.
Notice your lab credentials in the Lab details pane. You use them to sign in to the Looker instance for this lab.
Click Open Looker.
Enter the provided Username and Password in the Email and Password fields.
Username:
Password:
Click Log In.
After a successful login, you see the Looker instance for this lab.
In Looker, a dimension is a group-able field and can be used to filter query results. It can be:
For example, dimensions for a Products view might include product name, product model, product color, product price, product created date, and product end-of-life date.
Dimensions let you create buckets of data points to analyze your KPIs using different attributes. You can create different types of dimensions like time
, numeric
, yesno
and string
to slice and dice your data.
In this section, you will create a new dimension named age_tier based off of the age dimension. This dimension will list ranges of ages. You will do this by adding a dimension that groups individual ages into the following age group tiers: 18, 25, 35, 45, 55, 65, 75, 90
.
Click the Develop tab and then select the qwiklabs-ecommerce
LookML project.
Once you are in the qwiklabs-ecommerce
project, click the arrow next to views to see a list of view names.
Click users.view
.
In users.view
, locate the dimension for age. Your file should resemble the following:
Dimension fields, such as age correspond to your underlying database table, or computed values based on other dimensions.
The editor gives you suggestions as you type, but if you get stuck or need to see a list of different parameters and their attributes, you can always refer to the Quick Help menu on the right-hand side of the IDE.
tier
, so you'll add that here:integer
:Your file should now resemble the following:
Now that you finished adding a new dimension, you can test to make sure it's working properly.
Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
You can quickly go to the Explore by clicking the caret next to the file title at the top of the IDE and then selecting Explore Order Items.
This file menu will only show views that have an Explore defined in the LookML.
Next, navigate to your new dimension under Users > Dimensions > Age Tier.
Add the Age and the Age Tier dimensions and click Run. You can see that each age falls into the correct tier:
In this section, you will create a new dimension named is_email_source based off of the traffic_source dimension. This dimension will determine whether the traffic source that brought in a given user was via email.
Navigate back to the qwiklabs-ecommerce
project and open users.view
file.
Locate the dimension for traffic_source. Your file should resemble the following:
yesno
type:Lastly, add the SQL parameter. For this dimension, you're telling the SQL parameter to pull from the pre-existing traffic_source field where the value equals "Email".
Be sure to use double quotation marks (""
) when defining "Email" to ensure accurate syntax:
Your file should now resemble the following:
Now that you finished adding a new dimension, you can test to make sure it's working properly.
Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
Click the caret next to the file title at the top of the IDE and then select Explore Order Items:
Next, navigate to your new dimension under Users > Dimensions > Is Email Source (Yes / No).
Add the Is Email Source dimension and the Count measure and click Run. The results are showing the amount of users that were brought in via email or not. Success!
In this section, you will create a new dimension named shipping days that calculates the number of days between the order ship date and the order created date within the order_items view.
Navigate back to the qwiklabs-ecommerce
project and open the order_items.view
file.
Locate the dimension group for shipped. Your file should resemble the following:
number
type:DAY
is used here as the provided interval you want to be calculating:Your file should now resemble the following:
Now that you finished adding a new dimension, you can test to make sure it's working properly. Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
Click the caret next to the file title at the top of the IDE and then select Explore Order Items.
Next, navigate to your new dimension under Order Items > Dimensions > Shipping Days.
Add the Shipping Days dimension and the Order Count measure and click Run. The results are showing the count of orders with their respective shipping days. Success!
Navigate back to the order_items.view
file.
Click Validate LookML and then click Commit Changes & Push.
Add a commit message and click Commit.
Lastly, click Deploy to Production.
Click Check my progress to verify the objective.
A measure is a field that uses a SQL aggregate function, such as COUNT
, SUM
, AVG
, MIN
, or MAX
. Any field computed based on the values of other measure values is also a measure. Measures can be used to filter grouped values. For example, measures for a Sales view might include total items sold (a count), total sale price (a sum), and average sale price (an average).
The behavior and expected values for a field depend on its declared type, such as string
, number
, or time
. For measures, types include aggregate functions, such as sum
and percent_of_previous
. For details, refer to dimension types and measure types.
Measure fields are used to aggregate values for multiple rows. In this section, you will create a new measure named count_distinct_orders that calculates the distinct number of orders within the order_items
view.
Navigate back to the qwiklabs-ecommerce
project and open order_items.view
file.
In order_items.view
, locate the measure for order_item_count.
On a new line under the measure for order_item_count, start by defining a new measure for count_distinct_orders using the following code:
order_count
) with count_distinct_orders
.count_distinct
type. The type count_distinct calculates the number of distinct values in a given field. It makes use of SQL’s COUNT DISTINCT
function:Your file should now resemble the following:
Now that you finished adding a new measure, you can test to make sure it's working properly.
Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
Click the caret next to the file title at the top of the IDE and then select Explore Order Items.
Under Order Items > Measures, click Count Distinct Orders.
Click Run to see the values in the new measure. You can confirm that your new measure is working properly.
In this section, you will create a new measure named total_sales that calculates total sales using the sale_price dimension.
Navigate back to the qwiklabs-ecommerce
project and open order_items.view
file.
In order_items.view
, locate the measure for order_item_count.
On a new line under the measure for order_item_count, start by defining a new measure for total_sales using the following code:
sum
:value_format_name
parameter enables you to format data values using formats built into Looker or your own custom, reusable formats. Here, since you are calculating sale price you will use US dollars (usd_0
):Your file should now resemble the following:
Now that you finished adding a new measure, you can test to make sure it's working properly.
Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
Click the caret next to the file title at the top of the IDE and then select Explore Order Items.
Under Order Items > Measures, click Total Sales.
Click Run to see the values in the new measure.
order_items.view
file.Click Validate LookML and then click Commit Changes & Push.
Add a commit message and click Commit.
Lastly, click Deploy to Production.
Click Check my progress to verify the objective.
Advanced measures let you create additional custom metrics from dimensions that are defined externally to the current view file. You can also create special types of filtered measures by providing specific filtering conditions.
In this section, you will create a new advanced measure named total_sales_email_users that calculates total sales for only those users who came to the website via the email traffic source.
Navigate back to the qwiklabs-ecommerce
project and open order_items.view
file.
In order_items.view
, locate the measure for order_item_count.
On a new line under the measure for order_item_count, start by defining a new measure for total_sales_email_users using the following code:
sum
:Lastly, you will add the filters parameter. To apply a filter directly to a measure, instead of filtering the entire query, we can add a filters parameter to the LookML definition of a measure. This will apply the filter, in the form of a CASE WHEN
statement, to the measure in the generated SQL, as opposed to applying a global WHERE
clause to the entire query.
As such, instead of removing rows from a query after it is aggregated, a filtered measure will only aggregate those rows that meet the specified conditions. This approach allows us to examine subsets of a population vs. other subsets or the whole.
users.view
file:Your file should now resemble the following:
Now that you finished adding a new measure, you can test to make sure it's working properly.
Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
Click the caret next to the file title at the top of the IDE and then select Explore Order Items.
Under Order Items > Measures, click Total Sales Email Users.
Click Run to see the values in the new measure.
In this section, you will create a new advanced measure named percentage_sales_email_source that calculates the percentage of sales that are attributed to users coming from the email traffic source.
Navigate back to the qwiklabs-ecommerce
project and open order_items.view
file.
In order_items.view
, locate the measure for order_item_count.
On a new line under the measure for order_item_count, start by defining a new measure for percentage_sales_email_source using the following code:
number
:percent_2
:NULLIF
SQL function.
Your file should now resemble the following:
Now that you finished adding a new measure, you can test to make sure it's working properly.
Click Save Changes and then click the Validate LookML button on the top right of the IDE to run a LookML code validation.
Click the caret next to the file title at the top of the IDE and then select Explore Order Items.
Under Order Items > Measures, click Percentage Sales Email Source.
Click Run to see the values in the new measure. Success!
order_items.view
file.Click Validate LookML and then click Commit Changes & Push.
Add a commit message and click Commit.
Lastly, click Deploy to Production.
Click Check my progress to verify the objective.
In this lab, you learned how to create different types of dimensions and measures in LookML as a Looker developer. You also learned how to modify models of Explores, which are data views that serve as the foundation for self-service exploration by the business users in Looker, and create advanced measures with filters.
...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 April 22, 2024
Lab Last Tested May 18, 2023
Copyright 2025 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