Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Business Intelligence with Looker Cookbook
Business Intelligence with Looker Cookbook

Business Intelligence with Looker Cookbook: Create BI solutions and data applications to explore and share insights in real time

eBook
$21.99 $31.99
Paperback
$39.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Business Intelligence with Looker Cookbook

Getting Started with Looker

“Just as Google’s mission is to organize the world’s information and make it universally accessible and useful, Looker’s is to do the same for your business data so that you can build insight-powered workflows and applications.”

This is how the Welcome to Looker page greets you. Looker is one of the products of the Google Cloud BI family. The Google Cloud BI family also includes Looker Studio (Free and Pro versions), which was created by Google in 2016 and used to be called Google Data Studio. This book focuses on Looker, and Looker Studio won't be covered.

Looker is an advanced business intelligence (BI) solution acquired by Google in 2019. It is part of Google Cloud Platform. In order to start using it, you need to fill in the Contact Sales form and wait for the free trial to be created for you by someone from the Google Cloud sales team. At the time of writing this book, it is still the process to follow.

You can contact the sales team to get some help with your Looker exploration, but this book aims to make you autonomous in your Looker journey.

In this chapter, we’re going to cover the following recipes:

  • Getting access to Looker
  • Providing access to your team
  • Connecting to data in Looker
  • Building a LookML project
  • Connecting Looker to Git
  • Making and saving changes in views
  • Creating a LookML model and an Explore
  • Building Looks from Explores
  • Creating a dashboard from a Look

Technical requirements

In this chapter, we’ll be working with the Looker (Google Cloud core), built on Google Cloud infrastructure – therefore, you have nothing to install. You just need internet access, a browser, and a Google (personal or professional) account to access the Google Cloud console.

Getting access to Looker

In this recipe, you will discover how to get access to the Looker environment and start working in it. As mentioned in the introduction, we’ll focus on Looker (Google Cloud core), which is available from the Google Cloud console.

How to do it...

The steps for this recipe are as follows:

  1. Let’s start by going to the Google Cloud website: https://cloud.google.com/?hl=en. Once on the website, check whether you’re connected with your Gmail account by checking your Gmail profile photo in the top-right corner. Make sure that you’re connected with the email account you want to use for your Looker tests. If all is good, in the same top-right corner, click on Console (Figure 1.1).
Figure 1.1 – Google Cloud home page

Figure 1.1 – Google Cloud home page

  1. After clicking on Console, you will be redirected to the Google Cloud environment where you will need to choose your country, read and accept the Terms of Service, and click Agree and Continue.
  2. Note that you might be redirected to a Console page in a different language (your local language, for example). To follow the book’s guidelines easily, it is preferable to switch to the English version – you can do that in your Google account settings (https://myaccount.google.com/) or, on the first Google Cloud page where you clicked on Console, there was an option to choose the language before going to the console (check the top-right corner in Figure 1.1).
  3. If it’s your first time working within Google Cloud, you will need to create your first project by clicking on Create Project on the right (on the Google Cloud Welcome window after clicking on Agree and Continue). If you already have projects in your Google Cloud environment, you might still want to create a new one for your Looker experiment.
  4. After clicking on Create Project, you will need to choose a project name (or keep the default one) and organization, if you have one created – you might have one if you’re using your professional account. If not, keep the default No Organization option. Click CREATE to finalize the project creation (Figure 1.2). A Google Cloud project is a way to organize your resources and applications in Google Cloud Platform (GCP). It is a billing and access control entity. By creating a project, you can group your GCP resources together and control who has access to them. You can always switch between your projects in the top-left corner.
Figure 1.2 – Project creation

Figure 1.2 – Project creation

  1. When you’re on the Welcome page with your project chosen in the top-left corner, you can continue the activation of your free trial for your Google Cloud (GC) environment by clicking on START FREE in the top-right corner.
  2. On the Step 1 of 2 Account Information page (Figure 1.3), choose your country, and your organization or needs (there is an Other option if you don’t know yet), and then read and accept the Terms of Service.

Figure 1.3 – Account information

Figure 1.3 – Account information

  1. On the Step 2 of 2 page (Figure 1.4), you will need to provide your billing information. There is no autocharge after the free trial ends. Google only asks you for your credit card to make sure you are not a robot. If you use a credit or debit card, you won’t be charged unless you manually upgrade to a paid account.
Figure 1.4 – Payment information

Figure 1.4 – Payment information

  1. Google will verify your billing information; this is usually done through your banking application.
  2. Now, you’ll need to fill in a small questionnaire to help GC serve you better.
  3. Let’s finally get to Looker! Search for Looker either in the Search bar or by clicking on the hamburger button on the left (Figure 1.5). You can pin the Looker service in the hamburger menu to have it always at the top of your list.

Important note

Currently, to initiate a Looker free trial within your GC console, you’ll need to contact Looker sales directly. You can do this through the following form: https://cloud.google.com/resources/looker-free-trial.

Figure 1.5 – Search bar

Figure 1.5 – Search bar

  1. When you are on the Looker Welcome page, click on CREATE AN INSTANCE (Figure 1.6) to create your Looker instance. Important: To avoid any billing surprises, confirm your free Looker trial is active before creating your instance. You can check the trial status by contacting a Looker sales representative. A Looker instance is a dedicated, isolated environment for running Looker. Looker instances allow users to connect to data sources, model data, explore data, visualize data, share data, and embed analytics.
Figure 1.6 – Looker Welcome page

Figure 1.6 – Looker Welcome page

  1. If you see a popup that says Enable required APIs, click on Enable. The Looker (Google Cloud core) API is a RESTful API that allows you to programmatically interact with your Looker instance.

    On the page that will open after you enable the required APIs or after you click on CREATE AN INSTANCE, choose your instance name, then add your OAuth Application Credentials details to access your instance (Figure 1.7). You will need to create your OAuth application credentials in advance. To do this, open a new tab, go to the GC console, click on the menu button in the top - left corner and search for API & Services and click on it ->then click on Credentials -> then click on Create credentials (choose the Web application option) -> then choose OAuth client ID. It might ask you to create an OAuth consent screen where you will need to provide the app name and your email address in the Support and Developer section and keep the default values for the rest.

  2. Once your client ID is created, go back to your instance creation form and add your newly created credentials there. Finally, choose a region (if you can’t find your country, choose the one that is closer to you geographically) and click CREATE. The creation can take up to 1 hour.

Important note

After the free trial, your instance may be automatically converted to a paid Looker instance. Please confirm this with your Looker sales representative.

Figure 1.7 – Looker instance creation

Figure 1.7 – Looker instance creation

  1. When the instance is created, you will see your Looker instance link in the Instance URL column (Figure 1.8).
Figure 1.8 – Instance URL

Figure 1.8 – Instance URL

Troubleshooting Instance URL Errors

To avoid getting an error when clicking on the instance URL (such as, for example, Error 400: redirect_uri_mismatch), check the following elements:

  • You connected with the right Google account (when you’re connected with multiple Gmail accounts, the one that is used when you open the instance URL in the new tab might not be the one that has access to your Looker and GC environment)
  • In APIs & Services, make sure you created your OAuth credentials for the Web application
  • In APIs & Services, make sure you added your Looker instance URL plus /oauth2callback in Authorized redirect URIs (Figure 1.9)
  • In APIs & Services, make sure you added looker.app as the authorized domain on your OAuth consent screen (click Edit App to add it)

Figure 1.9 – Authorized redirect URIs

Figure 1.9 – Authorized redirect URIs

There’s more...

It is possible to get access to Looker through labs, as a way to test Looker without creating your own GC environment and without setting up a free trial. You can create an account on the Cloud Skills Boost website (https://www.cloudskillsboost.google/) and find free Looker quests and labs (make sure it is Looker and not Looker Studio). The labs on Cloud Skills Boost give you access to the sandbox environment with the data prepared for you. The labs give you a step-by-step exercise and teach you how to use Looker. The inconvenience is that you have limited time for your exercise. Additionally, you cannot work with your data and with your team on one project in the lab. These labs are only for training purposes and give you a good start in understanding the Looker environment.

For more in-depth exploration, you can combine the lab training and this book.

Providing access to your team

When you create your first Looker instance, you become its owner and administrator. You can then provide access to the rest of your team. Remember, by default, with the Standard edition, Looker gives you 12 free user allocations with the Standard version – 2 developers and 10 standard users. The Standard edition is tailored for small teams with up to 50 internal platform users.

For your free trial space, it is best to add only the colleagues who will actively participate in testing Looker with you.

How to do it...

To add your colleagues to your Looker free trial instance you will need to do the following:

  1. In the GC console, go to the IAM & Admin section.
  2. Click on the IAM tab.
  3. Click on GRANT ACCESS (Figure 1.10).
Figure 1.10 – Cloud IAM

Figure 1.10 – Cloud IAM

  1. In New principals, add an email (should be a Google account) or multiple emails of your co-testers.
  2. In Select a role, type Looker to filter, then assign your colleagues the same Looker role you have (for example, Looker Admin) to ensure they have the same level of access as you during the trial.
  3. Send the Looker instance URL to the person that you provided access to (to find your instance URL, see Figure 1.8).
  4. When they click on the link or copy and paste it into the browser, they will be asked to authenticate with their Google account.
  5. Once authenticated, your colleagues will see the same Looker Welcome page you saw when first connected to Looker.

Important note

When managing user permissions in Looker, it’s important to grant access based on specific needs. While collaboration is key, admin access should be reserved cautiously. For most colleagues, assigning “Looker instance user” status is sufficient.

See also

  • Other (more advanced) user roles and connection options will be discussed later in this book: Chapter 9, Administering and Monitoring Looker.

Connecting to data in Looker

You’ll need to connect Looker to the data source to start working on your data models, visualizations, and so on. Looker supports over 30 dialects – therefore, it can connect to more than 30 types of databases and data warehouses. The full list of dialects is here: https://cloud.google.com/looker/docs/looker-core-dialects#supported-dialects-for. In this book, we will use the connection to BigQuery. BigQuery is Google’s fully managed, serverless data warehouse that enables scalable analysis over petabytes of data. BigQuery is quite known as well for its native connection with Google Analytics.

How to do it...

Let’s explore BigQuery first. The steps for this are as follows:

  1. In your GC console, search for BigQuery in the search bar at the top of the console or in the navigation menu (represented by three horizontal lines) on the left side of the console and you should see your project name in the Explorer section (in our case, it’s lookerbook, but you might have a different name).
Figure 1.11 – BigQuery welcome page

Figure 1.11 – BigQuery welcome page

  1. In the Explorer section, click on the three dots near your project name (lookerbook in the preceding figure) and click on Create dataset (Figure 1.12). A dataset is like a folder that will contain your future data tables.
Figure 1.12 – Dataset creation

Figure 1.12 – Dataset creation

  1. Name your dataset, choose US in Multi-region where your data will live, and keep everything else as it is, then click on CREATE DATASET (Figure 1.13).
Figure 1.13 – Dataset configurations

Figure 1.13 – Dataset configurations

  1. In this book, to avoid searching for data, we will work with BigQuery public datasets. BigQuery public datasets are datasets that are stored in BigQuery and made available to the general public through the Google Cloud Public Dataset Program. These datasets are provided by a variety of organizations, including government agencies, non-profit organizations, and businesses. You can load your own data into BigQuery (for example, click on three dots near your newly created dataset, click on Create table, and then Create table from). For more information on how to load your data into BigQuery, check this link: https://cloud.google.com/bigquery/docs/loading-data.
  2. To work with the public dataset, you first need to add it to your Explorer section (to make it visible). The public dataset is not stored in your project; it is hosted by Google, so you won’t have to pay for storage. But you can create the table out of the public dataset table to store it in your project.
  3. To add the public dataset to your BigQuery space, click on ADD in your Explorer section, then click on Star a project by name (Figure 1.14) and add bigquery-public-data.
  4. Another option to add public datasets is to go to Additional sources in Figure 1.14, and from there, you can scroll to find public datasets.
  5. You can then explore the different datasets available and click View dataset when there is one you find interesting – usually, after that, you will see the bigquery-public-data project pinned in Explorer with all the datasets in it.

Figure 1.14 – Adding a public dataset

  1. Find the Google Analytics 4 (GA4) dataset in your starred bigquery-public-data project. It is not real GA4 data but it will give you an idea of how your GA4 data will look in BigQuery. Click on ga4_obfuscated_sample_ecommerce and then click on the events_(92) table (using the SCHEMA, DETAILS, and PREVIEW tabs in Figure 1.15).
Figure 1.15 – Google Analytics dataset

Figure 1.15 – Google Analytics dataset

  1. Click on QUERY button (located above the SCHEMA, DETAILS and other table-related tabs), then choose In new tab, enter the following SQL query, then click RUN (Figure1.16):
    SELECT
    PARSE_DATE("%Y%m%d",event_date) as Session_Date,
    device.category AS Device_category,
    COUNT(*) AS Nb_of_sessions
    FROM
      `bigquery-public-data.ga4_obfuscated_sample_ecommerce.  events_202101*`
    WHERE event_name = 'session_start'
    GROUP BY 1,2
    ORDER BY 1,2 ASC;
Figure 1.16 – Running a query

Figure 1.16 – Running a query

  1. In this query, we’re trying to get the number of sessions on the website per device type by day for January 2021. Click on SAVE RESULTS above your Query results table and save it as BigQuery table (Figure 1.17) to your previously created dataset (mydata or another name if you decided to name it differently) in your GC project.
  2. Name the table device_category_jan2021 and then click Export.
Figure 1.17 – Save the results

Figure 1.17 – Save the results

  1. If you see that the job (all tasks are called jobs in BigQuery) failed, it might be because your dataset was created in another region. Getting a table from the public dataset that is in US and exporting it to your dataset in EU is not possible, so make sure that you created your mydata dataset in the US multi-region.
  2. Go and check whether the table was created. Now, you have your own dataset that contains your own small table (Figure 1.18).
Figure 1.18 – Device category table

Figure 1.18 – Device category table

Connecting Looker to BigQuery

Let’s go back to our Looker instance to connect Looker to BigQuery. Make sure you have at least two tabs open – one with the GC console and another one with the Looker instance.

Let’s explore the Looker environment. The steps for this are as follows:

  1. In your Looker instance, click on Admin on the left, then click on Database and Connections, and then click the Add Connection button (Figure 1.19).
Figure 1.19 – Database connection

Figure 1.19 – Database connection

  1. When you click on Add Connection, give your connection a name (bq_connection1, in our case) and choose a dialect (Google BigQuery Standard SQL in our case).
  2. Fill in the form (Figure 1.20) with your billing project ID and dataset, choose the standard UTC time zone, and for the rest, keep the default values, then click on CONNECT to establish the connection. To find your project ID (where the billing is configured), go to the GC console, click on your project name in the top-left corner near the Google Cloud logo, and copy the ID from the pop-up window.
Figure 1.20 – Database connection configuration

Figure 1.20 – Database connection configuration

How it works...

The connection was relatively simple because Looker (Google Cloud core) has a native connection with GC services. We also configured very few elements, to keep it simple. The goal of this chapter is to quickly go through the Looker basics to give you an overview of how it works. Let’s continue with the LookML project creation.

See also

Building a LookML project

A LookML project is a collection of LookML files that describe how to access and model data for BI and data visualization.

Think of LookML as a collection of recipe instructions for turning raw data into insightful dishes. Instead of ingredients and steps, you define the data’s components (such as customer names, product types, and sales numbers) and how to combine them (think filtering, grouping, and calculating). Looker, your helpful kitchen assistant, reads these instructions and provides the data ready to be used by anyone, no matter their data-cooking skills.

LookML files are written in a declarative language that defines the dimensions, measures, calculations, and relationships between tables in a database. Looker uses LookML to generate SQL queries that retrieve data from the database and present it in a user-friendly interface. The key components of a LookML project are model files, view files, Explores, dimensions and measures. LookML projects are a powerful way to create a single source of truth for your data.

Getting ready

Before creating your first LookML project, make sure Development Mode is activated (Figure 1.21). To do this, in the left navigation panel, toggle the Development Mode switch on.

Figure 1.21 – Development Mode toggle

Figure 1.21 – Development Mode toggle

You can exit Development Mode by clicking on Exit Development Mode in the top-right corner.

In the next chapters, we will work with Development Mode activated.

How to do it...

The steps for this recipe are as follows:

  1. Exit from the Admin navigation tab and make sure you see the Explore, Develop, and Admin tabs on the left.
  2. Click on Develop, then click on Projects (Figure 1.22).
Figure 1.22 – Projects

Figure 1.22 – Projects

  1. When you’re on the Projects page, click on New LookML project.
  2. On the project creation page, give your project a name (test_project in our case), choose the database/data warehouse connection you created previously (bq_connection1), keep the other fields as they are, and click on Create Project (Figure 1.23).
Figure 1.23 – New Project

Figure 1.23 – New Project

  1. In some cases, you might want to create multiple LookML projects. For example, LookML projects can have multiple model files, but if you want to set different permissions for users to view and edit LookML for specific model files, you can create separate projects for each model.

How it works...

When creating your LookML project, you have three starting points available:

The Generate Model from DB Schema option is the one we used in this chapter; it gives Looker the possibility to automatically detect tables and table columns and build a basic model that you can edit if you need to. It is an option that is used quite often.

For some specific cases, you might want to create a blank project to start everything from scratch. To do this, select Blank Project.

When you choose Clone Public Git Repository, you can get some LookML models, views, and other files configured and ready to use from the existing Git repository.

In this chapter, we chose the first option. But even this option eventually needs a Git connection so you can work on your LookML projects with your colleagues and/or partners and have certain version control in case there are any changes made.

When you create your first project, you will see the LookML development page with an automatically created model and view (or views, depending on whether you have one or multiple tables) – see Figure 1.24.

Figure 1.24 – LookML model and view

Figure 1.24 – LookML model and view

See also

Connecting Looker to Git

LookML projects are version-controlled using Git, which allows LookML developers to track changes, collaborate on the project, see the history, revert to previous versions, and configure CI/CD.

Getting ready

Make sure you are on your LookML project (Figure 1.24). To get to your LookML environment, you can click on the menu on the left (the Explore, Develop, and Admin tabs), then click on Develop and choose your project (test_project in our case).

How to do it...

The steps for this recipe are as follows:

  1. On your LookML page, click on Configure Git in the upper right-hand corner of the page (almost any Git provider will work, including GitHub, GitLab, and Bitbucket).
Figure 1.25 – Configure Git

Figure 1.25 – Configure Git

  1. If you don’t yet have a Git repository where you want your LookML project to live, you can click on Set up a bare repository instead (Figure 1.25).

Important note

For secure and reliable version control, consider using your own Git repository hosted outside of your Looker server. This ensures that your LookML code and its history are safe, even if something happens to the Looker instance or server.

  1. On the Configure Bare Git Repository page, click on Create Repository.
  2. After clicking on Create Repository, click on Back to project.

How it works...

Once your LookML project is connected to Git, you can start tracking changes to your files. Any changes you make will be saved to your local Git branch. When you are ready to share your changes with other developers, you can push your branch to the remote repository.

Other developers can then pull your changes to their local branches and merge them into their own work. If there are any conflicts, Git will help you to resolve them.

When you are ready to deploy your changes to production, you can merge your development branch into the production branch. Looker will then automatically deploy the latest changes to your production environment.

There’s more...

You can use your existing Git repository for Looker. For this, provide your repository URL on the Configure Git page (Figure 1.25). You can create a new repository on one of the supported Git platforms: GitHub, GitLab, Bitbucket, Phabricator Diffusion and others.

On the Configure Git page (Figure 1.25), there are links to the instructions on how to create your repository in any of the listed Git platforms.

Making and saving changes in views

Views in Looker are tables of data that are defined in LookML. Views can be based on existing database tables, or they can be derived from tables that are created using LookML-based query or SQL query.

Views are used to organize data in Looker. They can also be used to create custom dimensions and measures. Views are typically declared in view files, with one view per file. Each view file contains a definition of the table, including the fields that are included in the view.

Views can be used in Explores to create data visualizations. They can also be used in joins to combine data from multiple views.

Getting ready

Make sure you are in Development Mode. Go to your LookML project environment and, on the left, open the views section/list. At this stage, you should see only one view based on the table we have in our BigQuery dataset – device_category_jan2021. Select this view to see the view’s LookML code in the code editor in the middle of the page (Figure 1.26).

Figure 1.26 – The device_category view

Figure 1.26 – The device_category view

We will make small changes in the views to see how the LookML code works and how you can prepare your data in this Looker semantic layer for your users.

How to do it...

The steps for this recipe are as follows:

  1. Place the cursor after line 6 (sql: ${TABLE}.Device_category ;;) and press Enter on your keyboard. In Looker, there’s a special character – $ – that acts as a substitution operator. It’s used to create more reusable and modular LookML code, allowing you to reference elements that have already been defined within your code. This helps to make your code cleaner, more organized, and easier to maintain.
  2. Explore the Quick Help section on the right that proposes different elements that you can add to enrich, enhance, or complete your dimension (Figure 1.27).
Figure 1.27 – Quick Help

Figure 1.27 – Quick Help

  1. In the empty line, start typing the word description, then add a description similar or different to the one in Figure 1.28.
Figure 1.28 – Dimension description

Figure 1.28 – Dimension description

  1. Place the cursor after line 21 (type: count) and press Enter on your keyboard.
  2. In the empty line, start typing the word description, then add a description similar or different to the one in Figure 1.29.
Figure 1.29 – Measure description

Figure 1.29 – Measure description

  1. Place your cursor on line 23 after the curly bracket and press Enter. You can now start creating new measures. Copy and paste this code to create a new measure that will count the total of sessions (per device, per day, depending on the dimensions that you will choose for your visualization later):
      measure: total_sessions {
        type: sum
        sql: ${nb_of_sessions} ;;
      }
  2. Now that we have added some descriptions and created a new measure, we want to make sure that our code is correct. To do this, you should click on Save Changes, then click on Validate LookML in the top-right corner (Figure 1.30). If everything is correct, you will see No LookML errors found in the Project Health window on the right.
Figure 1.30 – Validate LookML

Figure 1.30 – Validate LookML

  1. Click on Save Changes.
  2. You will now see the Commit Changes and Push button in the top-right corner; you might want to use it when you are ready to share your work with your teammates (if you don’t push changes to your Git repository, your team won’t be able to see your LookML project and the changes made to it). Don’t rush to commit. Verify your LookML edits by testing them in an Explore before committing permanently (Explores will be explained in the next recipe).

How it works...

As explained previously, a view is a representation of a table in LookML that contains dimensions and measures that are used to define the data that can be used in Explores to create data visualizations.

In Looker, dimensions are filterable data columns (like dates, names, IDs) that often come from your tables, but some can be built within LookML. For example, device_category and session_date are different dimensions within our BigQuery dataset.

Measures are aggregations of one or more dimensions (or unique attributes of the data) such as a count or average. Measures allow you to calculate key performance indicators (KPIs) that help your users analyze data using different aggregated attributes.

Once the view or the views are created, and all the necessary dimensions and metrics are enriched/completed/added, you can save changes and use your views in models and Explores.

See also

Creating a LookML model and Explore

As seen in the previous recipe, a LookML project is a collection of files that define a semantic data model for a SQL database. It contains model files, view files, and other types of files. We explored views that represent your database/data warehouse tables. Now, to make these dimensions and measures in the views usable, we need to create Explores.

An Explore is a custom view of the data that is defined using a LookML model. It is the starting point for querying data in Looker. Explores in Looker empower self-service data analysis with secure access, enabling creation of reports, dashboards, and visualizations. Explores can be based on one or multiple tables.

Explores are created in the LookML model file. The LookML model files contain Explores based on one or multiple tables joined (Figure 1.31).

Figure 1.31 – LookML project organization (image from GC documentation)

Figure 1.31 – LookML project organization (image from GC documentation)

Model files can contain different additional parameters, which we will review later in this book.

Getting ready

When you created your LookML projects and chose Generate Model from Database Schema, your model file was created by default. Click on your test_project.model model file to open it in the code editor (Figure 1.32). In this model file created automatically, you see multiple elements: connection, include, datagroup, persist_with, and explore. We will understand the meaning of all of them later, but for now, let’s create our own model file and the Explore in it.

Make sure you’re in Development Mode.

Figure 1.32 – Model

Figure 1.32 – Model

How to do it...

The steps for this recipe are as follows:

  1. To the right of File Browser, click on the + symbol and choose Create Model (Figure 1.33). You will need to provide a name for your model; let’s call it devices_model.
Figure 1.33 – LookML file creation

Figure 1.33 – LookML file creation

  1. When the model file is created, it is usually created outside of the models section but you can always move it there (just drag and drop it). You will see that the model contains connection and include sample elements. connection specifies the database/data warehouse connection, and include specifies the files that can be used in this model. You can change these elements if needed, but for now, we’ll keep the default options. Other elements are commented with the # symbol, and serve to show you how to create your first Explores based on multiple views (Figure 1.34).
Figure 1.34 – Device model

Figure 1.34 – Device model

  1. Delete all the commented (gray) section and start typing explore: {}. Add the name of our only view, device_category_jan2021. It will look like this: explore: 'device_category_jan2021 {}'(Figure 1.35). It is something we’ve seen in the automatically created model. The include parameter that you see in the figure is a way to bring together different LookML files. It lets you access and use components from other files within your current file. You can use it in model, view, and explore files to include different types of files, such as view files, dashboard files, Explore files, and data test files.
Figure 1.35 – Explore

Figure 1.35 – Explore

  1. Click on Save Changes.
  2. Click on the arrow icon to the right of devices_model.model and make sure that Explore Device Category Jan2021 – devices_model was created (Figure 1.36).
Figure 1.36 – Model drop-down list

Figure 1.36 – Model drop-down list

  1. Click on Explore Device Category Jan2021 – devices_model and the Explore environment will open (Figure 1.37).
Figure 1.37 – Explore environment

Figure 1.37 – Explore environment

How it works...

Looker has three basic types of users: Developer (Admin), Standard (Creator), and Viewer. When we were in the LookML project, we acted as a Developer user.

In the Explore space that we just opened, we’ll act as Standard users or creators, those who can create visualizations (or Looks). Let’s explore Explores in the next sections.

See also

Building visualizations (Looks) from Explores

Explores are built by developers for creators so that creators don’t have to think about how to prepare the data, join tables, specify cache and so on. All they should do is choose their columns, and visualization types, add filters if needed, and save their work.

Looks are individual data visualizations or tables based on Explores that can be readily integrated into dashboards. Edits to a Look automatically update in all dashboards where it's included, ensuring consistent and accurate data. Note that it’s uncommon to save everything as a single Look and then add it to a dashboard. This approach makes folder organization difficult. Usually, you create a visualization within Explore and save it to a dashboard directly from Explore.

Getting ready

Make sure you are in the Explore environment (Figure 1.37). On the left, you have the columns available. They can be from one (in our case) or multiple tables joined. In the middle, you have three sections: Filters, Visualization, and Data. In the top-right corner, you have the gear icon and Run button. We’re currently in the Explore called Device Category Jan2021.

Let’s build our first Look.

How to do it...

The steps for this recipe are as follows:

  1. Make sure your columns are visible by clicking on the arrow to the right of Device Category Jan2021 to expand the list of columns (a field picker) in the left panel.
  2. Click on the Device Category column and you will see it appear in the Results panel in the middle of the screen (Figure 1.38).
  3. Expand the Session Date list of columns in the right panel and click on Date.
  4. Then, click on Nb of Sessions, and in the top-right corner, click on Run to send the request to your BigQuery data warehouse. You will then obtain the table with the results (Figure 1.38).
Figure 1.38 – Query results

Figure 1.38 – Query results

  1. Expand the Visualization section by clicking on it. The visualization you’ll see probably will not make any sense; we’ll work on our columns and visualization to show something meaningful.
  2. At this stage, our Nb of Sessions column is located in DIMENSIONS and not MEASURES so Looker probably doesn’t read it as quantitative data. If you click on the three dots near your Nb of Sessions column, you will see available options to modify the column. Click on Aggregate and then on Sum (Figure 1.39). This will create a custom field called Sum of Nb of Sessions. While Looker developers typically fill the field picker by creating dimensions and measures in the LookML project, custom fields let you create your own dimensions and measures in Explores. Custom fields you add won’t be saved permanently within the data model.
Figure 1.39 – Dimension to measure

Figure 1.39 – Dimension to measure

  1. Let’s restart our Look (visualization) creation by first removing the columns we chose before. Click on the gear icon near your column name in the Results section, then click on Remove (Figure 1.40).
Figure 1.40 – Managing columns

Figure 1.40 – Managing columns

  1. Once you have cleaned the Results table by removing the columns, click on the Device Category and Sum of Nb of Sessions columns in your left panel to make them appear in the Results table, and click on Run to populate the data.
  2. Once the data is there, in the Visualization panel in the Column visualization (the second icon after the word Visualization), you will see a column chart visualization appear on your screen (Figure 1.41).
Figure 1.41 – Visualization

Figure 1.41 – Visualization

  1. Click on the gear icon near the Run button and choose Save… and As a Look (Figure 1.42). Give it the name Nb of Sessions per Device and click on Save.
Figure 1.42 – Managing the created Look

Figure 1.42 – Managing the created Look

  1. Now, let’s create another visualization (Look). Remove Device Category from the Results panel and click on Session Date and then Date. Our goal here is to see the evolution of the number of sessions per day. Once you have your two columns, Date and Sum Nb of Sessions, click on Run.
  2. In the Visualization panel, choose the Line visualization and you will see the evolution of the number of sessions per day in your graphic (Figure 1.43). As a reminder, sessions = visits to the website.
Figure 1.43 – Line visualization

Figure 1.43 – Line visualization

  1. Save this visualization as a Look with the title Nb of Sessions per Day.
  2. Go to the home page (by clicking on the Looker logo in the top-left corner).
  3. Click on Folders and then My folder in the left panel (Figure 1.44) to verify that your Looks were created.
Figure 1.44 – Folders

Figure 1.44 – Folders

How it works...

Explores are usually created by the LookML developers (data engineers, Looker admin, and so on) so that analysts can build their dashboards using the available prepared columns in the Explore space. In this recipe, we created Looks (visualizations) from the columns that were available thanks to the work that has been done in the LookML space. Every time we choose a combination of columns and click Run, Looker, in the backend, launches an SQL query to our database or data warehouse. The way Looker connects to the data, reads the data, does the joins, and so on – all that is specified in our LookML project.

Creating a dashboard from a Look

After you have learned how to explore and visualize data, you can start creating dashboards. Dashboards let you put multiple tables or graphs on one page so you can quickly see related information. You can also make dashboards interactive so users can filter them down to the specific data they want.

How to do it...

The steps for this recipe are as follows:

  1. On the Looker home page, click on Folders.
  2. In My folder (where you have a list of Looks you created), open the Nb of Sessions per Day Look by clicking on it.
  3. In the Nb of Sessions per Day Look, click on the gear icon in the top-right corner and click Save… and then As a new dashboard (Figure 1.45). Give your new dashboard a name, Sessions Dashboard, and click Save.
Figure 1.45 – Saving as a new dashboard

Figure 1.45 – Saving as a new dashboard

  1. Go back to Folders followed by My folder to check whether the dashboard was created (Figure 1.46).
Figure 1.46 – My folder: Dashboard and Looks

Figure 1.46 – My folder: Dashboard and Looks

  1. Click on the Nb of Sessions per Device Look, then once in the Look, click on the gear icon in the top-right corner, click Save and To an existing dashboard, and then choose the dashboard you created in the previous steps, Sessions Dashboard. Click Save to Dashboard.
  2. In the green ribbon that appears after you click on Save to Dashboard, click on Sessions Dashboard (Figure 1.47) to check your dashboard and whether all the Looks were added.
Figure 1.47 – Dashboard creation message

Figure 1.47 – Dashboard creation message

A dashboard can contain more than two Looks. In this recipe, we explored a simple dashboard to understand how it works, but we’ll dive deeper into this topic later in this book.

How it works...

In this recipe, we created the dashboard from a Look. Note that Look should be in the same folder with the dashboard. There are multiple other ways to create dashboards in Looker, as follows:

  • Create an empty dashboard and then build Looks through the Explore interface in the dashboard (click Add in the top-left corner of the dashboard)
  • Create a dashboard from the LookML dashboard file
  • Create a dashboard through the Looker API

See also

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore data visualization, analysis, and reporting with Looker to gain insights from your data
  • Connect to data sources, build dashboards, and create reports to track and share key metrics
  • Share insights with your team to make better business decisions
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Looker is a data analytics and business intelligence platform that allows organizations to explore, analyze, and visualize their data. It provides tools for data modeling, exploration, and visualization, enabling you to gain insights from your data to make informed business decisions. You’ll start with the basics, from setting up your Looker environments to configuring views and models using LookML. As you progress, you’ll delve into more advanced topics, such as navigating data in Explore, tailoring dashboards to your needs, and adding dynamic elements for interactivity. Along the way, you'll gain invaluable troubleshooting skills to tackle common issues and optimize your Looker usage, ensuring a smooth and seamless experience. Furthermore, the book extends your understanding beyond the basics, equipping you with the knowledge you need to develop Looker applications and seamlessly integrate them with other tools and applications. You'll also explore advanced techniques for harnessing Looker's full potential, empowering you to establish data-driven decision-making and innovation within your organization. By the end of this BI book, you'll have gained a solid understanding of how to use Looker to find important information, make tasks easier, and derive important insights.

Who is this book for?

If you’re a business analyst, data analyst, or BI developer who wants to get well-versed with the features of Looker, this book is for you. Basic knowledge of business intelligence is required to get started.

What you will learn

  • Understand Looker's key components, including LookML, data models, and dashboards.
  • Explore Looker's functionality, including custom fields, calculations, and visualizations.
  • Work with Looker dashboards using dynamic elements like links and actions.
  • Use different types of filters for dimensions to create dashboards
  • Develop Looker applications using essential tools and frameworks
  • Explore additional applications for the Looker organization
  • Integrate Looker with other tools using APIs, connectors, and data pipelines
Estimated delivery fee Deliver to Ecuador

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 24, 2024
Length: 256 pages
Edition : 1st
Language : English
ISBN-13 : 9781800560956
Vendor :
Google
Category :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Ecuador

Standard delivery 10 - 13 business days

$19.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

Product Details

Publication date : May 24, 2024
Length: 256 pages
Edition : 1st
Language : English
ISBN-13 : 9781800560956
Vendor :
Google
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 156.97
Data Engineering with Google Cloud Platform
$41.99
Business Intelligence with Looker Cookbook
$39.99
Data Quality in the Age of AI
$74.99
Total $ 156.97 Stars icon
Banner background image

Table of Contents

12 Chapters
Chapter 1: Getting Started with Looker Chevron down icon Chevron up icon
Chapter 2: Configuring Views and Models in a LookML Project Chevron down icon Chevron up icon
Chapter 3: Working with Data in Explores Chevron down icon Chevron up icon
Chapter 4: Customizing and Serving Dashboards Chevron down icon Chevron up icon
Chapter 5: Making Dashboards Interactive through Dynamic Elements Chevron down icon Chevron up icon
Chapter 6: Troubleshooting Looker Chevron down icon Chevron up icon
Chapter 7: Integrating Looker with Other Applications Chevron down icon Chevron up icon
Chapter 8: Organizing the Looker Environment Chevron down icon Chevron up icon
Chapter 9: Administering and Monitoring Looker Chevron down icon Chevron up icon
Chapter 10: Preparing to Develop Looker Applications Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(2 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Silja Märdla Oct 03, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I read it cover to cover, to remind myself of all the options out there. I wanted to make sure I don’t forget something essential when working on Looker design and guidelines for my organisation. For me, the little suggestions alog the lines of “ususally this functionality can be used for…” were very helpful to get me thinking about how I want to do things.Thinking back on how I first started learning Looker, this book would have been useful. It does start from the very beginning of how you get started, but then goes on to cover most of the functionality. Meaning, you’ll be able to do more than someone who just completed a 1-hour “getting started” tutorial. And, you will have a solid understanding of the big picture of what the tool offers and where your own work stands relative to the full offering.It’s a reasonably quick read: it describes what you can do, shares an example and moves on to the next thing. If you have any previous experience with any other BI tool, but you want to learn a new tool, this book will be perfect for you. It’s probably not a book you can use to learn data and business intelligence from scratch, especially if you’re not very tech savvy.
Amazon Verified review Amazon
S. Jun 24, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I just finished reading "Business Intelligence with Looker Cookbook" by Khrystyna Grynko. The guide comprehensively covers every aspect of Looker, but it could benefit from more tips on speeding up processes, especially when using Looker ML models. I revised several familiar concepts and learned about new features, such as embedding Looker into external websites and integrating it with platforms like Google Sheets and Looker Studio. However, I missed information on integrating with Gemini. Overall, it's a must-read for mastering Looker and streamlining data visualization processes.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela