On this page
Kater SQL Functions Calculation context
Calculation context
These calls work a measure out again in another context, such as the total of all channels on each channel's row.
Write them by hand where no menu writes them. The query’s filters stay unless a call changes them, and the measure’s own definition always applies. See Change a measure’s context.
| Function | What it does |
|---|---|
TOTAL | Works a measure out at a broader grouping, such as all channels, on each row. |
SHARE_OF_TOTAL | Divides a measure on each row by its total at a broader grouping. |
VALUE_FOR | Works a measure out for one value of a dimension, such as the web channel, on each row. |
CALCULATE_ACROSS | Removes the dimensions you name from a measure’s grouping, and keeps the query’s filters. |
CALCULATE_BY | Works a measure out at exactly the dimensions you name, then combines those values for each row. |
CALCULATE_PER | Adds the dimensions you name to the query’s grouping, works the measure out there, then combines those values for each row. |
RATIO | Divides one value by another on each row, such as units by orders. |
RUNNING_TOTAL | Adds up a value from the first row of the result through each row, in the order you give. |
MOVING_AVERAGE | Averages a value over this row and the rows before it, in the order you give. |
CUMULATIVE_SHARE | Divides the running total of a value by the sum of all rows, so the last row is 100 percent. |
BY | Keeps only the grouping dimensions you name, in TOTAL, SHARE_OF_TOTAL or VALUE_FOR. |
ACROSS | Removes the grouping dimensions you name, in TOTAL, SHARE_OF_TOTAL or VALUE_FOR. |
IGNORE_FILTERS | Removes the query’s filters on the dimensions you name, in TOTAL, SHARE_OF_TOTAL or VALUE_FOR. |