RMAX (window)
Syntax
RMAX( value [ , direction ] [ TOTAL | WITHIN ... | AMONG ... ] [ ORDER BY ... ] [ BEFORE FILTER BY ... ] )
Description
Returns the maximum of all values in a growing (or shrinking) window defined by the sort order and the value of direction
:
direction |
Window |
---|---|
"asc" |
Starts from the first row and ends at the current row. |
"desc" |
Starts from the current row and ends at the last row. |
By default "asc"
is used.
Window functions with a similar behavior: RSUM, RCOUNT, RMIN, RAVG.
Argument types:
value
—Boolean | Date | Datetime | Number | String | UUID
direction
—String
Return type: Same type as (value
)
Note
Only constant values are accepted for arguments (direction
).
Warning
The sorting order is based on the fields listed in the chart's sorting section and in the function's ORDER BY
clause. First, ORDER BY
fields are used, and then they are complemented by the fields from the chart.
Examples
RMAX([Profit])
RMAX([Profit], "asc")
RMAX([Profit] TOTAL)
RMAX([Profit], "desc" WITHIN [Date])
RMAX([Profit] AMONG [Date])
Data source support
Materialized Dataset
, ClickHouse 1.1
, Microsoft SQL Server 2017 (14.0)
, MySQL 5.6
, Oracle Database 12c (12.1)
, PostgreSQL 9.3
.