To create the Position column, you should use the FIRST () function. The FIRST () function returns the number of rows from the current row to the first row in the partition. For example, the first row in a partition will return 0, the second row will return -1, and so on. In this question, the partition is defined by the Segment field, and the table is sorted by the Sales field in descending order. Therefore, the Position column shows the offset of each row from the first row in each segment, based on the sales ranking. References:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit