Skip to main content
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.

FunctionWhat it does
TOTALWorks a measure out at a broader grouping, such as all channels, on each row.
SHARE_OF_TOTALDivides a measure on each row by its total at a broader grouping.
VALUE_FORWorks a measure out for one value of a dimension, such as the web channel, on each row.
CALCULATE_ACROSSRemoves the dimensions you name from a measure’s grouping, and keeps the query’s filters.
CALCULATE_BYWorks a measure out at exactly the dimensions you name, then combines those values for each row.
CALCULATE_PERAdds the dimensions you name to the query’s grouping, works the measure out there, then combines those values for each row.
RATIODivides one value by another on each row, such as units by orders.
RUNNING_TOTALAdds up a value from the first row of the result through each row, in the order you give.
MOVING_AVERAGEAverages a value over this row and the rows before it, in the order you give.
CUMULATIVE_SHAREDivides the running total of a value by the sum of all rows, so the last row is 100 percent.
BYKeeps only the grouping dimensions you name, in TOTAL, SHARE_OF_TOTAL or VALUE_FOR.
ACROSSRemoves the grouping dimensions you name, in TOTAL, SHARE_OF_TOTAL or VALUE_FOR.
IGNORE_FILTERSRemoves the query’s filters on the dimensions you name, in TOTAL, SHARE_OF_TOTAL or VALUE_FOR.