Skip to main content

Rank

Rank Function

Assigns rank for a group of rows based on the given group by and order by conditions.

Syntax

Rank(table Table, array GroupByColumns, scalar Rank, scalar Column, scalar Order, scalar Column, scalar Order, ...)

Arguments

ArgumentDescription
table TableTable
array GroupByColumnsArray of column vectors to group the data
scalar RankRank if 0, all rows will be returned
scalar ColumnColumn name to get rank over
scalar OrderOrder of the column to get rank over ♣ true for ascending ♣ false for descending

Examples:

Rank([[FusionTestTable]], array([FusionTestTable.VarcharColumn], [FusionTestTable.SmallIntColumn]),1, [FusionTestTable.DateTimeCol], true, [FusionTestTable.IntColumn], false, [FusionTestTable.DoubleColumn], false )

Returns rows of data grouped by "VarcharColumn" and "SmallIntColumn" with the specified rank ordered by "DateTimeCol" ascending, "IntColumn" and "DoubleColumn" descending.