docs / articles / Unlocking Looker: Mastering Segment Blocks

Unlocking Looker: Mastering Segment Blocks

Lisa Jul 26, 2026 2026-07-26 18:03:27

In the realm of data exploration and business intelligence, Looker's Segment and Block features have emerged as powerful tools for creating insightful data models and generating meaningful analytics. If you're a data analyst, developer, or business user looking to harness Looker's full potential, understanding these key concepts is a must.

the bearish order block is now available for all types of trading and forex
the bearish order block is now available for all types of trading and forex

Segment and Block are instrumental in shaping your data and delivering the right insights to your users, contributing to faster decision-making and enhanced data-driven performance across your organization.

Free Pattern Block Mats
Free Pattern Block Mats

Understanding Segments in Looker

Segments in Looker allow you to filter and subdivide your data based on specific conditions, enabling targeted and precise analysis. They serve as conditional filters that transform your data's dimension plane, making your data models more dynamic and versatile.

the bullish order block is shown in blue and white, with an arrow pointing to it
the bullish order block is shown in blue and white, with an arrow pointing to it

By harnessing the power of segments, you can:

  1. Inflate or deflate data to manipulate viewable data sizes.
  2. Create conditional filters to drill down into your data's details.
  3. Apply complex conditions to your data without affecting other analytics.
Pattern Block Cards
Pattern Block Cards

Defining Simple Segments

Simple segments apply 'where' filters to a dimension, using straightforward conditions like '=' or '!='. For instance, you can create a simple segment to display only sales in a specific region.

Syntax: `segment : name_of_segment dimension where condition`

several pieces of cardboard stacked on top of each other in the shape of cubes
several pieces of cardboard stacked on top of each other in the shape of cubes

Defining Complex Segments

Complex segments combine simple segments or matrix joins to create more intricate conditions. They offer a flexible way to slice and dice your data based on various criteria, supporting both AND and OR operators.

Syntax: `segment : name_of_segment segment where (simple_segment_1 and simple_segment_2) or (complex_segment_1 and complex_segment_2)`

some type of red and white object that is in the shape of a cube, with different
some type of red and white object that is in the shape of a cube, with different

Exploring Blocks in Looker

A block in Looker is a collection of measures that you can pin together for easy reuse across your data models. Essentially, they allow you to create and share reusable sets of calculations derived from your data.

Key Stage 2: 11 Plus Spatial Reasoning, 3D Shapes - Building Blocks, With this type of question you are given a 3D shape on the left which is constructed from several different sized blocks. You are also given four options (labelled 'a' to 'd) containing sets of blocks that could be assembled to form various 3D shapes. You are required to select the option that contains the blocks that could be put together to form the target image on the left..11 Plus for parents
Key Stage 2: 11 Plus Spatial Reasoning, 3D Shapes - Building Blocks, With this type of question you are given a 3D shape on the left which is constructed from several different sized blocks. You are also given four options (labelled 'a' to 'd) containing sets of blocks that could be assembled to form various 3D shapes. You are required to select the option that contains the blocks that could be put together to form the target image on the left..11 Plus for parents
Free Pattern Block Templates
Free Pattern Block Templates
Order - Block by Block
Order - Block by Block
the cover of high - probability order blocks, with an arrow pointing upward
the cover of high - probability order blocks, with an arrow pointing upward
an image of different shapes and colors on a white background, including hexagonals
an image of different shapes and colors on a white background, including hexagonals
the bos and order blocks pattern
the bos and order blocks pattern
an abstract sculpture made out of concrete blocks
an abstract sculpture made out of concrete blocks
six different types of cubes are shown in black and white, including one that has been
six different types of cubes are shown in black and white, including one that has been
bullish order block is displayed on the screen
bullish order block is displayed on the screen

With blocks, you can:

  • Simplify and standardize your measure calculations.
  • Improve code readability and organization.
  • Enhance reusability, fostering collaboration among your Looker instances.

Creating and Using Blocks

To create a block, first, write your measure calculations and then wrap them in a block declaration. For example, you can create a block for common sales calculations:

`block : sales_block { measure : total_sales { sum(orders.revenue) } measure : profit { orders.revenue - orders.cost } }`

Using Blocks in Your Data Models

Once defined, insert your block into the data model using the '@' symbol. For instance, to incorporate the sales block:

`: say hellotable { dimension : orders.id { orders.id } @sales_block }`

In conclusion, Looker's Segment and Block features empower you to carve meaningful data insights tailored to your users. Mastering these concepts enables you to build agile data models, streamlining the way you derive value from data. Embrace segments to segment your data intelligently, and blocks to calculate and shareyour measures effectively. Continuously refining your data model using these tools will help your organization unlock new insights and drive data-driven growth.