The absolute position (1-based) from which to obtain the data.
Relation
Optional
A table expression from which the output will be returned. If omitted, OrderBy must be explicitly specified.
OrderBy
Optional
Columns that define how each partition is sorted. If omitted, Relation must be explicitly specified.
Blanks
Optional
An enumeration used to define how to handle BLANK OrderBy values. Valid value is DEFAULT for now.
PartitionBy
Optional
Columns that define how Relation is partitioned.
MatchBy
Optional
Columns that define how the current row is identified.
Reset
Optional
Specifies how the calculation restarts. Valid values are: None, LowestParent, HighestParent, or an integer.
Return Values
A row at an absolute position.
Remarks
Each partitionBy and matchBy column must have a corresponding outer value to help define the “current partition” on which to operate, with the following behavior:
If there is exactly one corresponding outer column, its value is used.
If there is no corresponding outer column:
INDEX will first determine all partitionBy and matchBy columns that have no corresponding outer column.
For every combination of existing values for these columns in INDEX’s parent context, INDEX is evaluated and a row is returned.
INDEX’s final output is a union of these rows.
If there is more than one corresponding outer column, an error is returned.
If matchBy is present, INDEX will try to use matchBy and partitionBy columns to identify the row.
If matchBy is not present and the columns specified within orderBy and partitionBy cannot uniquely identify every row in relation:
INDEX will try to find the least number of additional columns required to uniquely identify every row.
If such columns can be found, INDEX will automatically append these new columns to orderBy, and each partition is sorted using this new set of OrderBy columns.
If such columns cannot be found, an error is returned.
An empty table is returned if:
The corresponding outer value of a PartitionBy column does not exist within relation.
The position value refers to a position that does not exist within the partition.
If INDEX is used within a calculated column defined on the same table as relation and orderBy is omitted, an error is returned.
reset can be used in visual calculations only, and cannot be used in combination with orderBy or partitionBy. If reset is present, axis can be specified but relation cannot.
Enhance a table so it contains, for each month:
– the total sales amount;
– the difference to the first month of the respective year;
– and the difference to the first month of the respective quarter.
The screenshot below shows the visual matrix and the first visual calculation expression: