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, useREMOVEorTOTAL.- The measure’s own definition still applies: the
WHEREof 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 ordersWHERE KATER__IS_EQUAL_TO(orders.region, 'AMER')GROUP BY orders.channelORDER BY 1| Channel | Units | All Units |
|---|---|---|
| 546 | 9,154 | |
| paid | 604 | 9,154 |
| store | 534 | 9,154 |
| web | 495 | 9,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
- Change a measure’s context
- Pass through, evaluate or declare
- Other functions in EVAL and its modifiers:
EVAL,REMOVE,SET,SET_CUSTOM,CURRENT