Skip to main content
On this page

Kater SQL Functions EVAL and its modifiers

CLEAR

Removes all of the SELECT's grouping and filters from an EVAL, so the measure is its grand total.

Family: EVAL and its modifiers

Write it inside EVAL.

Syntax

EVAL(measure, CLEAR())

Arguments

CLEAR() takes no arguments.

Returns

The measure over every row that its definition allows, on each row of the result.

Usage notes

  • CLEAR() also drops the query’s filters. To keep the filters and drop only some of the grouping, use REMOVE or TOTAL.
  • The measure’s own definition still applies: the WHERE of its model and its required filters.
  • 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.channel AS "Channel",
EVAL(orders.sum__quantity) AS "Units",
MEASURE('all_units', EVAL(orders.sum__quantity, CLEAR())) AS "All Units"
FROM kater_dataset.orders AS orders
WHERE
KATER__IS_EQUAL_TO(orders.region, 'AMER')
GROUP BY
orders.channel
ORDER BY
1
ChannelUnitsAll Units
email5469,154
paid6049,154
store5349,154
web4959,154

The query keeps only AMER, but All Units is the same on every row: the units of every region and every channel.

See also