Kater SQL Functions EVAL and its modifiers
CURRENT
Gives a dimension's value on the row being worked out, inside a SET in an EVAL.
Family: EVAL and its modifiers
Use it to compare each row with another, such as the month before.
Syntax
EVAL(measure, SET(dimension = CURRENT(dimension) - n))Arguments
| Argument | Description |
|---|---|
dimension | A dimension that the SELECT groups by or filters by, such as orders.order_month. |
Returns
The dimension’s value on the row. It is null when the SELECT neither groups nor filters by the dimension.
Usage notes
- On a date grain, a number counts periods of that grain. On a month,
CURRENT(orders.order_month) - 1is the month before. On a year,- 1is the year before. CURRENTworks only insideSETin anEVAL.VALUE_FOR,TOTALandSHARE_OF_TOTALtake constant values.
Example
This Sandbox query reads the sample shop’s orders. The table shows the rows that Kater gave.
SELECT orders.order_month AS "Order Month", EVAL(orders.sum__quantity) AS "Units", MEASURE('units_month_before', EVAL(orders.sum__quantity, SET(orders.order_month = CURRENT(orders.order_month) - 1))) AS "Units the Month Before"FROM kater_dataset.orders AS ordersWHERE KATER__IS_ON_OR_AFTER(orders.order_month, DATE '2026-05-01')GROUP BY orders.order_monthORDER BY 1| Order Month | Units | Units the Month Before |
|---|---|---|
| 2026-05-01 | 441 | 374 |
| 2026-06-01 | 403 | 441 |
| 2026-07-01 | 438 | 403 |
| 2026-08-01 | 454 | 438 |
| 2026-09-01 | 442 | 454 |
The query starts in May, but May’s row still shows April’s units. SET replaces the filter on the month, so the month before counts.
See also
- Change a measure’s context
- Pass through, evaluate or declare
- Other functions in EVAL and its modifiers:
EVAL,CLEAR,REMOVE,SET,SET_CUSTOM