Skip to main content
On this page

Kater SQL Functions EVAL and its modifiers

SET_CUSTOM

Replaces all of an EVAL's grouping and filters with one condition of your own.

Family: EVAL and its modifiers

Write it inside EVAL.

Syntax

EVAL(measure, SET_CUSTOM(condition))

Arguments

ArgumentDescription
conditionA condition that names at least one of the measure’s dimensions, such as orders.channel IN ('web', 'email'). It cannot read a measure, an aggregate, a window or a parameter.

Returns

The measure over the rows that the condition keeps, on each row of the result.

Usage notes

  • The condition replaces every part of the context, the grouping included. A row’s region or month no longer applies, unless the condition names it.
  • The measure’s own definition still applies.
  • It cannot be mixed with another modifier in the same EVAL.

Example

This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.

SELECT
orders.region AS "Region",
EVAL(orders.sum__quantity) AS "Units",
MEASURE('online_units', EVAL(orders.sum__quantity, SET_CUSTOM(orders.channel IN ('web', 'email')))) AS "Online Units, All Regions"
FROM kater_dataset.orders AS orders
WHERE
KATER__IS_NOT_NULL(orders.region)
GROUP BY
orders.region
ORDER BY
1
RegionUnitsOnline Units, All Regions
AMER2,1794,532
APAC2,0974,532
EMEA2,4214,532
LATAM2,2604,532

Online Units is the same on every row: the web and email units of every region. The condition replaced the grouping by region too.

See also