Skip to main content
On this page

Kater SQL Functions EVAL and its modifiers

SET

Replaces one dimension's grouping and filter with one value.

Family: EVAL and its modifiers

Write it inside EVAL, or after the measure in VALUE_FOR, TOTAL or SHARE_OF_TOTAL.

Syntax

EVAL(measure, SET(dimension = value) [, SET(dimension = value) ...])

Arguments

ArgumentDescription
dimension = valueThe dimension on the left, and its value on the right, such as orders.channel = 'web'. NULL selects the rows where the dimension is null.

Returns

The measure for that value of the dimension, on each row of the result.

Usage notes

  • The rows that the SELECT returns do not change. Only this one value does.
  • Several SETs apply in order, and each one sees the context the one before it set.
  • Inside EVAL, the value can read CURRENT, such as CURRENT(orders.order_month) - 1. In VALUE_FOR, TOTAL and SHARE_OF_TOTAL, the value must be a constant.
  • The measure’s own definition still applies.

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('web_units', EVAL(orders.sum__quantity, SET(orders.channel = 'web'))) AS "Web Units"
FROM kater_dataset.orders AS orders
WHERE
KATER__IS_NOT_NULL(orders.region)
GROUP BY
orders.region
ORDER BY
1
RegionUnitsWeb Units
AMER2,179495
APAC2,097520
EMEA2,421577
LATAM2,260504

See also