Tableau Desktop Certified Associate: Exam Guide
by Dmitry Anoshin, JC Gillet, Fabian Peri, Radhika Biyani, Gleb Makarenko
Using the Lookup function
When Tableau computes a table calculation for Percent Difference against the previous value, it actually uses one base table calculation function inside a more complicated calculation. If you wanted to drag and drop a Percent Difference calculation into the Dimensions pane and later Edit that calculation, the resulting formula would look something like the following (simplified for our purposes):
( (SUM([Sales]) - LOOKUP(SUM([Sales]), -1) ) / LOOKUP(SUM([Sales]), -1)
Here, we can see that we are making the most of a function called LOOKUP(expr, offset), which returns the value of the calculation specified by expr in a given cell, and more specifically of LOOKUP(expr, -1) to grab the results of the expression in the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access