Window Calculations (FIRST, LAST, INDEX, LOOKUP)
Window calculations like FIRST(), LAST(), INDEX(), and LOOKUP() operate on specific rows within a partition, enabling relative and positional calculations. They access values at specific positions in the data table. Window calculations are essential for rank-dependent logic, accessing neighboring values, and creating sequential calculations. They compute after data aggregation, and the table structure is determined.
To perform Windows calculations on rows, perform the following steps.
Using Kyvos OrderDate, create a view with "Category" on Rows and "Sum Sales" on Columns.
Create calculated field: "First Category Sales".
Drag First Category Sales to Columns (next to Sales)
Right-click the new field pill > "Edit Table Calculation"
Set Compute Using to Table (down).
Shows the first category's sales value for all rows.
Create another field as Sales Rank. The formula is INDEX().
Drag Sales Rank to Rows or Columns, Right-click Sales Rank in the view → select Edit Table Calculation.
Drag the sum sales to the columns for a better understanding of ranks.
10. Shows the position number of each row in the partition