Lookup (expression, [offset]):
This returns the value of the expression in a target row, specified as a relative offset from the current row.
In this blog, I would like to explain how to use lookup functions to compare quarter-on-quarter sales data from Sample superstore data set.
Step 1:
- Let us take Order Date Column and place year (order date) =2017 in filter in the shelf. Now let’s drag Quarter (Order date) from dimension and Sales from measure and place that in rows.

Step 2:
- To find the difference between quarters such as Q1 and Q2 , we can use Lookup() function.
- We can create a new calculation named “Previous quarter”:

- The first part of the calculation (Expression)gets the data for the current row.
- The second part of the calculation([offset]) looks at one row before the current row (-1).
- Finally, it subtracts the current row from the previous row, to get the difference.

- By using this Lookup() function, it is easier to see the previous year or quarter or monthly or weekly sales .

