Scope and direction

Scope and direction are terms that describe how a Table Calculation is computed relative to the table. When a Table Calculation is relative to the layout of the table, rearranging the fields in the view will not change the scope and direction:

  • Scope: The scope defines the boundaries within which a given Table Calculation can reference other values
  • Direction: The direction defines how the Table Calculation moves within the scope

You've already seen Table Calculations being calculated table (across) (the running sum of sales over time) and table (down) (in the previous table). In these cases, the scope was the entire table and the direction was either across or down. For example, the running total calculation ran across the entire table, adding subsequent values as it moved from left to right.

To define scope and direction for a Table Calculation, use the drop-down menu for the field in the view and select Compute Using. You will get a list of options that will vary slightly depending on the location of dimensions in the view. The first of the options listed allows you to define the scope and direction relative to the table. After the option for cell, you will see a list of dimensions present in the view. We'll take a look at those in the next section.

Options for scope and direction relative to the table:
  • Scope options: Table, pane, and cells
  • Direction optionsDown, across, down then across, across then down

In order to understand these options, consider the following example:

When it comes to the scope of Table Calculations, Tableau makes the following distinctions:

  • The table is the entire set of aggregate data.
  • The pane is a smaller section of the entire table. Technically, it is defined by the penultimate lowest level of the table; that is, the next-to-last dimension on the Rows and/or Columns shelf defines the pane. In the preceding image, you can see that the intersection of Year on Rows and Region on Columns defines the panes (one is highlighted, but there are actually eight in the view).
  • The cell is defined by the lowest level of the table. In this view, the intersection of one Department within a Region and one Quarter within a Year is a single cell (one is highlighted, but there are actually 96 in the view).

The bounded areas in the preceding screenshot are defined by the scope. Scope (and as we'll see, also partition) defines windows within the data that contain various Table Calculations. Window functions, such as WINDOW_SUM() in particular, work within the scope of a window.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.204.142