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
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
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

Billing Address

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

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 : 9781800563285
Vendor :
Google
Category :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
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

Billing Address

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.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
€189.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
€264.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 118.97
Data Engineering with Google Cloud Platform
€31.99
Business Intelligence with Looker Cookbook
€29.99
Data Quality in the Age of AI
€56.99
Total 118.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

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.