Report Designer Formula Reference

There are two places where formulas can be used in the report designer tool:

  • Row Filter formula for reports
  • Value Source formula for cells

Both have the same syntax, but are used in different ways.

The general formula language is inspired by the Excel formula language, but is different in several ways. It is also possibly to literally use the Excel format for a value source formula. This is covered in a separate reference.

Tip: Did you know we have a reference of formula patterns that solve common problems? Visit our Formula Recipes page.

Using Formulas Value Source Formulas

These can be entered in the Advanced section of Column Options.

A column must have a value source formula, otherwise it will be blank. The designer automatically generates a value source formula when you add a column to the report. It is simply the [Column Reference] for the column that was added.

To add a new report column so that you can enter a value source formula, click Layout -> Add Formula Column:

edbsn31cfbb5353688539544dc09dc55963b0306ecd5d75f8b7a88bb3ffd9420230be36724db06be66062c34ce010edb2a8f0dc58de38fcb4995ee3e9225cb40a66b7?inline=true

This will give a new blank column with the formula "Enter formula here" - a reminder to update the formula!

You may also reference another column from your report by using the Column Title {Column Title}.  i.e. surround the column title with {}. This allows you to use the value from a column in another column.  If you create a formula in a column, you can reference the formula in another column and display/use the result of the calculation.  This allows you to create complex formulas in one place, and then reference/reuse them in your report.  Any changes to the formula is then only required in one column, with the result flowing through to all columns that reference the {Column Title}.  

Row Filter Formulas

A single row filter formula can be entered in the Filter section of the designer. 

A row filter formula lets you exclude certain rows from appearing in the report. It must be some sort of comparison which produces a true/false outcome. If the formula evaluates to false for a row, it will be discarded. If the formula evaluates to true for a row, it will be included in the report.

You can also use the FILTER() function anywhere in a report. The function definition is FILTER(name, type, ["start"|"end"|"choice1", "choice2", ...])

Examples Notes

Only show Quantity Sold less than the selected value:

FILTER("Less than Qty", "integer") > [Quantity Sold]

Filter Order Date by a date range:

[Order Date] >= FILTER("Pick a Range", "date-range", "start")
AND [Order Date] <= FILTER("Pick a Range", "date-range", "end")

Filter Employee by a search string or show everything if the string is empty:

ICONTAINS([Employee], FILTER("Employee Name", "text"))
OR FILTER("Employee Name", "text") = NULL
OR FILTER("Employee Name", "text") = ""

Filter Payment method by using a drop-down list of choices:


[Payment Method] = FILTER("Payment Method", "drop-down", "All", "Credit Card", "Cash")
OR FILTER("Payment Method", "drop-down", "All", "Credit Card", "Cash") = "All"

Filter Product Name by using a multi-select drop-down list of choices:

[Product Name] = ANY(FILTER("Product", "drop-down-multi", "A4", "B5", "C6"))

OR "All" = ANY(FILTER("Product", "drop-down-multi", "A4", "B5", "C6"))

Filter Product Name by using a multi-select drop-down list sourced from the first column of another report:

[Product Name] = ANY(FILTER("Product", "drop-down-multi-report", "937q8c91"))

OR "All" = ANY(FILTER("Product", "drop-down-multi-report", "937q8c91"))
Filter Product Name by searching if ANY of the terms should match:
FILTER("Search String", "text") = NULL 

OR

FILTER("Search String", "text") = ""

OR

SEARCHOR(IFNULL[Product Name], ""), FILTER("Search String", "text"))
Filter Product Name by searching if ALL of the terms should match:
 
FILTER("Search String", "text") = NULL OR
FILTER("Search String", "text") = ""
OR
SEARCHAND(IFNULL[Product Name], ""), FILTER("Search String", "text"))

 

Creates a custom filter for your report. It will be shown with the name you specify to the user and will be of a specific type. The value that the user has inputted in the filter when running the report will be inserted as the value for the whole function.

Valid types are: "text", "integer", "float", "drop-down", "drop-down-multi", "drop-down-report", "drop-down-multi-report", "date-range" and "date".

When using "date-range" types you must also specify if you want the start or end date value from the filter.

When using drop-down-multi-report, you can find the report ID code at the end of the Wink url, eg: https://secure.winkreports.com/reports/59g63k91/937q8c91

 

Formula Language Reference

Column References

Columns values are referenced by putting the column name in square brackets. For example: [A Column]

Note: The column names are provided by the data source and do not change in formulas if the title is changed. 

When entering a formula, the designer will auto-complete to help you get the column reference correct. It's a good idea to use one of the suggestions, as the formula will not be valid if the column reference is spelled incorrectly (including capitalisation!).

QGSCleWL60Vk5GaWO8AwwZG7un_0uzX1-A?1518484169

Literals

Fixed values (i.e. literals) can be used in formulas.

Type Examples Notes
Whole Number 5,  -12  
Decimal Number 12.88,  -0.5  
Text "Hello",  "That's a bit \"interesting\"!" To include a double quote within text, precede it with back slash \
Null NULL Means 'no value'. Useful for hiding values and excluding values from averages.

Operators

Operators can be used to combine values. Order of operations is respected (i.e. parentheses first, then */, then +-, left to right).

Types Examples Notes
Addition [Total] + 100  
Subtraction [Total] - 100  
Multiplication [Total] * 100  
Division [Total] / 100 Division by 0 will result in a NULL value.
If both numerator and denomiator are whole numbers, the result will be a whole number too. You can force a floating point result by converting either argument using NUMBERVALUE or by adding 0.0
Text concatenation "Hello " & [First Name]  
Parentheses 5 * (10 + 20)  

Comparisons

Values can be compared. This is useful for row filters, or when using the IF function.

Type Examples Notes
Greater than [Total] > 5  
Greater than or equal to [Total] >= 5  
Less than [Total] < 5  
Less than or equal to [Total] <= 5  
Equal to [Total] = 5,  [Total] = NULL  
Not equal to [Total] <> 5,  [Total] <> NULL  
AND [Total] > 5 AND [Total] < 10 AND [Category] = "Widgets" Use parentheses to combine AND and OR
OR [Category] = "A" OR [Category] = "B" OR [Category] = "C" Use parentheses to combine AND and OR
Value in set [Category] = ANY("A", "B", "C") If the value matches any of the listed values
 Value not in set NOT([Category] = ANY("A", "B", "C")) If the value is not in any listed values

Functions

There are several functions which can be used to modify values. They consist of an upper case function name, followed by a number of arguments in brackets. For example: FUNCTION(value_1, value_2)

Text Functions

These functions only operate on text values.

Function Examples Notes
LEFT(value, character count) LEFT([Client Name], 20) Trims <value> to a maximum length of <character count> letter. <character count> should be a whole number.
RIGHT(value, character count) RIGHT([Client Name], 10) Trims <value> by taking the last <character count> letters. <character count> should be a whole number.
UPPER(value) UPPER([Client Name]) Converts <value> to upper case.
LOWER(value) LOWER([Client Name]) Converts <value> to lower case.
LENGTH(value) LENGTH([Client Name]) Calculated the length of the string. For example LENGTH("Bill") would return 4.
TRIM(value) TRIM("  String   with spaces   ") Removes unnecessary white space from a string. All leading and trailing spaces are removed as well as double spacing. For instance a <value> of "    String   with  spaces    " will be converted to "String with spaces"
SUBSTITUTE(value, old text, new text) OR
SUBSTITUTE(value, old text 1, new text 1, old text 2, new text 2, ...)

SUBSTITUTE([Client Name], "Smith", "Johnson") OR
SUBSTITUTE([Client Name], "Smith", "Johnson", "Woods", "Miller")
Replaces <old text> with <new text> in the string <value>. Any number of old/new pairs can be supplied.
SUBSTRING(value, regular expression) SUBSTRING([Note Text], "[a-z.]+@[a-z.]+") Extracts a substring from <value> which matches the given regular expression. Learn more about regular expression in our article Learn Regex The Easy Way.
REGEXP_REPLACE(value, regular expression, new value, flags?)

Example to turn person@example.com into redacted@example.com

SUBSTRING([Note Text], "[a-z.]+@([a-z.]+)", "redacted@\1", "g")

Replaces matches from <value> using the given regular expression. Learn more about regular expression in our article Learn Regex The Easy Way.

Flags are optional, and can be any of "ginsx".

Matches can be referenced in the <new value> using \1 \2, etc.

SPLIT(value, separator, index) SPLIT("Cat/Dog/Mouse", "/", 2)
returns "Dog"
Splits the string value into different parts as specified by the separated and returns the occurrence at the index position. The first value is at index 1.
SUMSPLIT(value, separator) SUMSPLIT("1,2,3,4", ",")
returns 10
Splits a string into different parts, convert them to numbers and sums them all up.
CHAR(code)
CHAR(9) - gives a tab
CHAR(10) - gives a newline
Generates a special character. Use 9 for tab, and 10 for newline.
SIMILARITY
 
 
INITCAP(value)
INITCAP([Client Name])
Converts the first letter of each word from <value> to upper case and the remaining to lower case.
INITCAP("john DOE") returns "John Doe"

Math Functions

These functions only operate on numeric values.

Function Examples Notes
CEIL(value) CEIL([Line Total]) Rounds up to the nearest whole number.
FLOOR(value) FLOOR([Line Total]) Rounds down to the nearest whole number.
SQRT(value) SQRT([Quantity]) Square root.
ABS(value) ABS([Line Total]) Absolute value (i.e. discard the negative sign).
ROUND(value, decimal_places) ROUND([Line Total], 2) Rounds the number to the given number of decimal places.
GPS_DISTANCE(lat_1, lng_1, lat_2, lng_2, [units])
GPS_DISTANCE(32.9697, -96.80322, 29.46786, -98.53506, "km")
Gives an approximate distance between two coordinates. Units must be one of "km", "mi", "nmi", and the default if omitted is "km"
RAND()
RAND()
Generates a random decimal between 0 and 1. Note: a new random number will be generated each time the report executes.
RANDBETWEEN(min, max)
RANDBETWEEN(1, 100)
Generates a random integer between min-max inclusive. Note: a new random number will be generated each time the report executes.

Date Functions

These functions only operate on date values.

Function Examples Notes
YEAR(value, [month]) YEAR([Invoice Date])

YEAR([Financial Year Date], 7)
Snap to the start of the calendar year. If you specify a month number then it will snap to the beginning of that month, eg 2019-01-12 will snap to 2018-07-01 if month=7
YEAREND(value, [month]) YEAREND([Invoice Date])

YEAREND([Financial Year Date], 7)
Snap to the end of the calendar year. If you specify a month number then it will assume the year begins on the first of that month. 2019-01-12 will snap to 2019-06-30 if month=7
QUARTER(value) QUARTER([Invoice Date]) Snap to the start of the calendar quarter.
QUARTEREND(value)
QUARTEREND([Invoice Date])
Snap to the end of the calendar quarter.
MONTH(value) MONTH([Invoice Date]) Snap to the start of the calendar month.
MONTHEND(value) MONTHEND([Invoice Date]) Snap to the last day of the calendar Month.
WEEK(value) WEEK([Invoice Date]) Snap to the start of the calendar week (Monday).
ISOWEEK(value) ISOWEEK([Invoice Date])
 
The week number of the year, using the ISO week definition.
DAY(value) DAY([Created Date]) Snap a datetime to a date, discarding the time component.
HOUR(value) HOUR([Created Date]) Snap the datetime to the hour.
MINUTE(value) MINUTE([Created Date]) Snap the datetime to the minute.
YEARVALUE(value) YEARVALUE([Date]) Returns the year from the date as a value, eg. 2017
QUARTERVALUE(value) QUARTERVALUE([Date[) Returns the quarter from date as a value, e.g. 3
MONTHVALUE(value) MONTHVALUE([Date]) Returns the month component from 01 to 12
MONTHNAME(value) MONTHNAME([Invoice Date]) Returns the month name eg. "April"
DAYVALUE(value) DAYVALUE([Invoice Date]) Returns the date component eg. 27
DAYNAME(value) DAYNAME([Invoice Date]) The day of the week for the date, eg "Tuesday"
DOW(value) DOW([Invoice Date]) The numeric day of week Sunday (0) to Saturday (6)
HOURVALUE(value) HOURVALUE([Invoice Date]) Returns the hour from the datetime as a value between 0 and 23.
MINUTEVALUE(value) MINUTEVALUE([Invoice Date]) Returns the minute from the datetime as a value between 0 and 59
DATETRIM(value) DATETRIM([Invoice Date]) Adds a filter to the report allowing the user to change the date resolution on the fly (e.g. yearly, monthly). Especially useful when aggregating or grouping by dates.
DATETOTIME(datetime_value) DATETOTIME([Created Datetime]) Extracts the time component from a datetime.
TODAY() TODAY() Today's date. Useful when filtering for dates before/after today.
NOW() NOW() Current datetime. Useful when filtering for datetimes before/after now.
 
 WORKDAY(start_date, n)
 
 WORKDAY([Date], 1)
Get a date n working days (excludes Saturdays and Sundays) in the future or past.
WORKDAYS(start, end, [holiday 1], [holiday 2], ...) WORKDAYS([Invoice Date], TODAY(), "2019-01-01", "2019-12-25") The number of work days (excludes Saturdays and Sundays) between start and end, inclusive of both days. Holidays can optionally be added as well in yyyy-mm-dd format or column references.
EPOCH(value) EPOCH([Date1] - [Date2]) Returns the number of seconds since the Unix Epoch Date 1970-01-01. Useful to calculate the number of seconds between 2 dates.

Epoch can also convert a durtion value such as "1:30:20" into seconds. To convert a duration to hours, use EPOCH([Duration])/60/60
INTERVALVALUE(value, units) INTERVALVALUE([Amount], "hours") Creates an interval which can be added to or subtracted from a datetime.
Valid units are: second, minute, hour, day, week, month, year. The plural version of each unit is also valid.
ISODATE(value) ISODATE([Invoice Date]) Converts a date (or datetime!) to ISO 8601 format. For example 2023-01-31
ISODATETIME(value) ISODATETIME([Modified At Datetime]) Converts a datetime to ISO 8601 format. For example 2023-01-31T12:31:08.552Z

Other Functions

Function Examples Notes
IF(condition_1, true_value_1, condition_n, true_value_n, false_value) IF([Total] > 50, "Large", "Small")
IF([Total] > 100, "Huge", [Total] > 50, "Medium", "Small")
Similar to the Excel IF function, except multiple conditions are supported. The conditions are checked from left to right.
IFNULL(value, fallback) IFNULL([Amount], 0) Replace any blank value with the supplied <fallback>. Both <value> and <fallback> should be the same type. Useful to show zeros where otherwise would be blank.
NULLIF(value_to_check, null_value) NULLIF([Amount], 0) Replace where the <value_to_check> equals <null_value> with NULL. Useful to show blanks where otherwise would be zeros.
GREATEST(value1, value2, value3, ...) GREATEST([Amount1], [Amount2], 5) Returns the largest (max) value of all the values passed to the function.
LEAST(value1, value2, value3, ...) LEAST([Amount1], [Amount2], 5) Returns the smallest (min) value of all the values passed to the function.
NOT(comparison) NOT(CONTAINS([Client Name], "Smith")) Provides the opposite value from a logical comparison or result. The example will include all rows which do NOT contain "Smith" in the Client Name column.
CONTAINS(haystack, needle) CONTAINS([Client Name], "Smith") Gives a true value if <needle> is found in <haystack>. Both arguments must be text types.
ICONTAINS(haystack, needle) ICONTAINS([Client Name], "smith") Gives a true value if <needle> is found in <haystack> ignoring upper/lower case. Both arguments must be text types.
STARTSWITH(haystack, needle) STARTSWITH([Client Name], "Xxx") Gives a true value if <haystack> starts with <needle>. Both arguments must be text types.
ENDSWITH(haystack, needle) ENDSWITH([Client Name], "Smith") Gives a true value if <haystack> ends with <needle>. Both arguments must be text types.
NUMBERVALUE(value) NUMBERVALUE("1.43")
NUMBERVALUE(1)
Converts text or integer input to a floating point number.

NUMBERVALUE can be used to convert durations, such as "3:15:30" to numbers but will round up to an integer value. Use EPOCH() instead for converting durations.
DATEVALUE(value, formatting)

DATEVALUE("2018-01-28", "yyyy-mm-dd")
DATEVALUE("28/1/18", "dd/mm/yy")
DATEVALUE(NUMBERVALUE("1692338451025")/1000, "epoch") 

Converts a text string to a date according to the formatting template specified. Valid template values are:
yyyy - year eg 2018
yy - year eg 18
mm - month eg 11
mon - month eg Apr
month - month eg April
dd - day eg 29
epoch - timestamp in milliseconds 

UNIXTOTIMESTAMP(value)

UNIXTOTIMESTAMP("1685061420")

Converts a Unix timestamp into a timezone-aware date time value.

TEXT(value) TEXT(25.3) Converts a number (or date) to a text string.
TEXT(value, format_pattern)
TEXT([Date], "dd/mm/yyyy")
TEXT([Line Amount], "$999,999.00")
Converts the given value to text using the format pattern.
 
Special characters include:
  1. 9 for optional digits, 0 to always include a digit
  2. yy, yyyy, m, mm, d, dd for parts of a date
  3. hh12, hh24, mi, ss for parts of a time component
JSON_BUILD_OBJECT()

JSON_BUILD_OBJECT(
"Date",[Date],
"Total",[Total]
)

Builds a JSON array of data with a Key, Value pair.  
JSON_KEYLOOKUP()

JSON_KEYLOOKUP(
[Column 1],"Key"
)

Retrieve a value from a JSON array using the nominated Key.
USER_FULL_NAME() USER_FULL_NAME()
Full name of the logged in user. (e.g. John Smith)
USER_FIRST_NAME() USER_FIRST_NAME()
First name of the logged in user. (e.g. John)
USER_LAST_NAME() USER_LAST_NAME() Last name of the logged in user. (e.g. Smith)
USER_EMAIL() USER_EMAIL()
Email address of the logged in user. (e.g. john@example.com)

Currency Conversion Functions

It is possible to convert currency values from one currency to a single base currency. By default AUD, CAD, EUR, GBP, NZD, USD and ZAR are supported as the "use_currency" values, but it can be overridden to use any other currency. If you know exactly which currencies your organisation(s) support, then it's advised to specify them in the function because it will speed up the number of lookups the report column has to do.

The following always use the latest exchange rates, and are quite fast to execute:

Function Examples Notes
FXAUD(from_currency, amount, [use_currency1], [use_currency2], ...) FXAUD("USD", 23.51)
FXAUD([Currency], [Total], "JPY", "USD")
Convert the value to AUD base currency. Optionally specify use_currency values for each currency you want to support converting from.
FXCAD(from_currency, amount, [use_currency1], [use_currency2], ...) FXCAD("USD", 23.51)
FXCAD([Currency], [Total], "JPY", "USD")
Convert the value to CAD base currency. Optionally specify use_currency values for each currency you want to support converting from.
FXEUR(from_currency, amount, [use_currency1], [use_currency2], ...) FXEUR("USD", 23.51)
FXEUR([Currency], [Total], "JPY", "USD")
Convert the value to EUR base currency. Optionally specify use_currency values for each currency you want to support converting from.
FXGBP(from_currency, amount, [use_currency1], [use_currency2], ...) FXGBP("USD", 23.51)
FXGBP([Currency], [Total], "JPY", "USD")
Convert the value to GBP base currency. Optionally specify use_currency values for each currency you want to support converting from.
FXNZD(from_currency, amount, [use_currency1], [use_currency2], ...) FXNZD("USD", 23.51)
FXNZD([Currency], [Total], "JPY", "USD")
Convert the value to NZD base currency. Optionally specify use_currency values for each currency you want to support converting from.
FXUSD(from_currency, amount, [use_currency1], [use_currency2], ...) FXUSD("CAD", 23.51)
FXUSD([Currency], [Total], "JPY", "CAD")
Convert the value to USD base currency. Optionally specify use_currency values for each currency you want to support converting from.
FXZAR(from_currency, amount, [use_currency1], [use_currency2], ...) FXZAR("USD", 23.51)
FXZAR([Currency], [Total], "JPY", "USD")
Convert the value to ZAR base currency. Optionally specify use_currency values for each currency you want to support converting from.

The following can look back in time and use the exchange rate at a certain date:

Function Examples Notes
FX<Code>HISTORICAL(from_currency, amount, at_date) FXAUDHISTORICAL("USD", 23.51, DATEVALUE("2021-01-01", "yyyy-mm-dd"))
FXEURHISTORICAL([Currency], [Total], [Date])
Convert the value to the given base currency at the given date.
Supported Codes are per the table above (AUD, CAD, EUR, GBP, NZD, USD, ZAR)
 
FXHISTORICAL(from_currency, to_currency, amount, at_date)
 
 FXHISTORICAL("AUD", "USD", 23.51, DATEVALUE("2021-01-01", "yyyy-mm-dd"))
 Same as above

Multi-Row Functions

Most of the functions in Wink Reports operates on the value in a single row. For instance you sum two columns from the same row.

However there are also functions which can be used to generate extra rows in a report, or to calculate values from neighbouring rows. The functions marked as "Window Functions" work the same as SQL window functions and operate across multiple rows, but won't reduce the number of rows in the report. To collapse rows for summaries, please look at Aggregation. It is also worth noting that using window functions and aggregation together in the same report can have unexpected results, so it's recommended to not combine them in your reports.

These functions can be conceptually tricky to understand, and are generally only recommended for advanced users. If you require any assistance, please raise a support ticket. :-)

Function Examples Notes
ROWSPLIT(value, separator) ROWSPLIT([Staff], ", ")
ROWSPLIT("John,Mark,Sue", ",")
This will split a field based on the supplied separator, but put each result in it's own row. In the second example we will end up with 3 rows, one for John, Mark and Sue each.

All other columns will have the same value.
ROWSERIES(from_value, to_value, step, [step_type]) ROWSERIES(10, 35, 5)
ROWSERIES([Start Date], [End Date], "2 month", "interval")
Creates a series of rows, each with a value starting at "from_value" up to "to_value", at the selected step interval. You can also specify the step type as a time interval.

The first example will create rows with the following values in the column: 10, 15, 20, 25, 30, 35.

Valid date step interval units are "second", "minute", "hour", "day", "week", "month" and "year".

All other columns will have the same value.
COUNT([partition1], [partition2], ...,) COUNT([Client], [Product]) Window COUNT function. Will count the number of rows each unique partition group appears. Eg. in the example will count the unique products used per client.
SUM(value_column, [partition1], [partition2], ...,) SUM([Total], [Client]) Window SUM function. Will sum up all the "Total" values from all rows for the current row's "Client".
AVERAGE(value_column, [partition1], [partition2], ...,) AVERAGE([Total], [Client]) Window AVERAGE function.
MAX(value_column, [partition1], [partition2], ...,) MAX([Total], [Client]) Window MAX function.
MIN(value_column, [partition1], [partition2], ...,) MIN([Total], [Client]) Window MIN function.
FIRSTVALUE(value_column, [partition1], [partition2], ..., [+sort1], [-sort2], ...) FIRSTVALUE([Total], [Client], [+Date]) Window function
LASTVALUE(value_column, [partition1], [partition2], ..., [+sort1], [-sort2], ...) LASTVALUE([Total], [Client], [+Date]) Window function
NTHVALUE(value_column, offset, [partition1], [partition2], ..., [+sort1], [-sort2], ...) NTHVALUE([Total], 3, [Client], [+Date]) Window function
ROWNUMBER([partition1], [partition2], ..., [+sort1], [-sort2], ...) ROWNUMBER([Client], [+Order Date]) Window function. Inserts a row number partitioned by Client, and sorted by Order Date. Use [-Order Date] for descending sort.
RANK([partition1], [partition2], ..., [+sort1], [-sort2], ...) RANK([Client], [-Total Amount]) Window function
DENSERANK([partition1], [partition2], ..., [+sort1], [-sort2], ...) DENSERANK([Product], [+Quantity]) Window function
PERCENTRANK([partition1], [partition2], ..., [+sort1], [-sort2], ...)
PERCENTRANK([partition1], [partition2], ..., [+sort1], [-sort2], ...)
Window function. Returns the relative rank of the current row, that is (rank - 1) / (total partition rows - 1). The value thus ranges from 0 to 1 inclusive.
CUMUL_DIST([partition1], [partition2], ..., [+sort1], [-sort2], ...)
CUMUL_DIST([partition1], [partition2], ..., [+sort1], [-sort2], ...)
Window function. Returns the cumulative distribution, that is (number of partition rows preceding or peers with current row) / (total partition rows). The value thus ranges from 1/N to 1.
LAG(value_column, offset, default, [partition1], [partition2], ..., [+sort1], [-sort2], ...) LAG([Spend], 1, 0.0, [Client], [+Date]) Window function
LEAD(value_column, offset, default, [partition1], [partition2], ..., [+sort1], [-sort2], ...) LEAD([Spend], 1, 0.0, [Client], [+Date]) Window function
MOVING_AVERAGE(window_size, value_column, [partition1], [partition2], ..., [+sort1], [-sort2], ...) MOVING_AVERAGE(2, [Quote Amount], [Client], [+Month]) Moving / Rolling Average calculation function. The example calculates the moving average of the current quote amount along with the previous 2 months per client. A window size of 0 will calculate over all preceding rows.
CUMUL_SUM(window_size, value_column, [partition1], [partition2], ..., [+sort1], [-sort2], ...)  CUMUL_SUM(2, [Quote Amount], [Client], [+Month]) Cumulative / Running Sum calculation function. The example calculates the running total of the current quote amount along with the previous 2 months per client. A window size of 0 will calculate over all preceding rows.