slices

Slices, built-in table

The Slices table is created when a dashboard is sliced. When slicing is enabled:

Examples

table T[t] = with
  [| as Product, as Color |]
  [| "Pants", "Blue" |]
  [| "Cap", "Red" |]
  [| "T-shirt", "White" |]

table Slices[slice] = slice by t title: T.Product subtitle: T.Color

{ tileColor: #(same(T.Color) into Slices) }
show table "Contents of slice" sliced with
  T.Product
  T.Color

When the slice “Pants” is selected, the tile shows:

Product Color
Pants Blue

Slicing tiles

Most tiles can be sliced by adding sliced after the title. For a tile that displays rows, its data table must include the slice dimension. This can be a secondary dimension, as added to the source table by slice by, or a primary dimension, as on Slices itself. Cross tables such as cross(Slices, Month) are also supported.

show table "Orders" sliced with
  Orders.Date
  Orders.Client
  Orders.Quantity
  order by Orders.Date

For a sliced linechart, group by a calendar expression in the table carrying slice:

show linechart "Weekly Quantity Sold" sliced with
  sum(WeekItems.QtySold) as "Qty Sold"
  group by WeekItems.monday

Syntax

table Slices[slice] = slice by [tuple] sort [Expr desc] first: Expr title: Expr subtitle: Expr empty: Expr

All vectors are expected to be in the same source table, which receives slice as a secondary dimension.

Remarks

The by tuple controls the number and order of slices. first: requires a single-column by. It moves the slice whose by value matches the provided expression to the first position. sort [...] controls the slice order. Use desc inside the sorting tuple for descending order. title is mandatory and must be unique per tuple value. subtitle is optional and can include up to 255 values per tuple. empty: is optional. When the source table produces no slice, empty: creates one fallback slice and uses its value as the title of this slice. When the source table produces no slice and empty: is omitted, slice creation fails. The number of slices is limited to 200,000. The Slices table can be created at most once per script.

sliced, keyword

The sliced keyword partitions a tile’s data by the slice dimension created by table Slices[slice] = slice by .... It takes no argument. The former slices: option is no longer accepted.

Examples

The sliced tile shows the units for the selected product. The global tile shows the total across all products:

table Orders = with
  [| as Product, as Qty |]
  [| "Shirt", 2 |]
  [| "Shirt", 3 |]
  [| "Hat", 4 |]

table Slices[slice] = slice by Orders.Product title: Orders.Product

show scalar "Selected product units" a1b2 sliced with sum(Orders.Qty)
show scalar "All products units" c1d2 with sum(Orders.Qty)

The sliced tile shows 5 for “Shirt” and 4 for “Hat”. The global tile shows 9 for either selection.

Slicing can also select a row directly from Slices, or the rows for that slice in a cross table. This example prepares a monthly target for each product:

table Products = with
  [| as Product, as Target |]
  [| "Shirt", 20 |]
  [| "Hat", 10 |]

table Slices[slice] = slice by Products.Product title: Products.Product
Slices.Product = same(Products.Product)
Slices.Target = same(Products.Target)

keep span date = [date(2026, 1, 1) .. date(2026, 2, 28)]
table Plan = cross(Slices, Month)
Plan.Target = Slices.Target

show table "Selected product" sliced { 1..6, 1..3 } with
  Slices.Product

show table "Monthly target" sliced { 1..6, 5..9 } with
  Month.month
  Plan.Target

For the “Shirt” slice, the first tile shows one row, “Shirt”, and the second shows January and February with a target of 20 each. For “Hat”, the monthly target is 10.

A downstream table must also carry the slice dimension. In this example, Sales.slice = Products.slice associates each product-day with its slice. The linechart groups by Sales.date, so its grouping table is built from data that carries both the date and the slice:

table Products[product] = with
  [| as Name, as DailyQty |]
  [| "Shirt", 2 |]
  [| "Hat", 4 |]

keep span date = [date(2025, 1, 1) .. date(2025, 1, 3)]
table Sales = cross(Products, Day)
Sales.Qty = Products.DailyQty

table Slices[slice] = slice by product title: Products.Name
Sales.slice = Products.slice

show linechart "Daily units" sliced with
  sum(Sales.Qty)
  group by Sales.date

The “Shirt” slice shows 2 units on each of the three days; the “Hat” slice shows 4 units on each day.

Remarks

In a show statement, a title must precede sliced; use "" for an empty title. Legacy coordinates, when present, precede sliced. Region placement and omitted placement are also supported.

The tile’s data table must carry the slice dimension. The source table of slice by receives it as a secondary dimension. Assign it explicitly to other tables when needed, as with Sales.slice above. It can also be a primary dimension, as in Slices itself or cross(Slices, Month).

For a sliced linechart, use a grouping expression from the table carrying slice, such as Sales.date above. Omitting the grouping can select the global Day, Week, or Month table, which usually has no slice dimension.

Declare Slices before using sliced. A sliced tile cannot be declared in a scope where the Slices table is filtered.

Inside a chart, put sliced on individual blocks. The chart tile itself does not accept the annotation.