• Tidak ada hasil yang ditemukan

Analyzing Data with Quick Table Calculations

Dalam dokumen Introduction to Data Visualization (Halaman 118-123)

DO NOT COPY

Practice 2: IF Functions using Shape

12. Analyzing Data with Quick Table Calculations

This module contains the following:

Table Calculation Overview Using Quick Table Calculations

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Table Calculations Overview

Table calculations are computations that are applied to the values for a measure in the view. Tableau computes table calculations locally after the results of a query are returned, which allows for a second- pass aggregation (for example, Running Total of SUM(Sales) by Order Date).

Scope and Direction

Table calculations have a scope of Table, Pane, and Cell, which defines the area where the calculation is performed or for each group the calculation is computed.

Table calculations also have a specific direction of across (default) or down along which the calculation is computed.

See Table Calculations in a View

1. Right-click any measure in a worksheet and choose Add Table Calculation.

2. Use the Table Calculation dialog box to set up the calculation you want to use, for example Percent of Total with scope of Table and a direction of Across: Table (across).

3. Observe how the view changes as the table calculation scope and direction are modified, for example, change to Table (down).

Levels of Control

Table calculations have four levels of user control, described below from simplest to most complex to apply to the data.

Level of User Control Description

Quick Table Calculation Accessible from the measure in the view, which will modify the measure and default scope and direction.

Add Table Calculation For more control in creating the table calculation from an existing measure, accessible from the measure in the view.

Edit Table Calculation Available from the measure in the view once a table calculation has been applied, and allows changes in the direction and scope.

Custom Table Calculation Available by saving the table calculation (drag and drop the field with the table calculation applied from your worksheet to the Data pane), and then open the saved calculation in the Calculated Field editor. Additionally, it can be written from scratch with the Calculated Field editor.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Using Quick Table Calculations

Quick table calculations are predefined computations that can be run against the data in your view.

Select the drop-down menu on the measure you want to use for the calculation and then select the type of quick table calculation to use.

Quick table calculations use a default direction for operations, such as “Table (across)”. They also use a default comparison type, such as the measure compared to the “previous” cell. You can change the direction with the Compute Using context menu, and change the comparison using the Relative To context menu.

Description are based on default behavior.

Quick Table Calculation Description

Running Total Adds totals across the table

Difference Calculates the difference from previous column, across a table.

Percent Difference Calculates the percent difference from previous column, across a table.

Percent of Total Calculates the values percent of the total sum in a table.

Rank Calculates the integer rank of the value across the table.

Percentile Calculates the statistical percentile of the value across the table.

Moving Average Calculates the average value based on a range around the current value. Used to smooth short term fluctuations.

YTD Total Calculates the running total from the beginning of the year across the table.

Compound growth rate Calculates the current value as a percentage from the first value.

Year over Year growth Calculates a percentage from the first value compared to the same period in the previous year.

YTD Growth Calculates a percentage change from the same time period in the previous year and then calculates a running total over a year.

Add a Quick Table Calculation

• On a measure field in a view, click the drop-down menu → select Quick Table Calculation → choose the calculation type.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Click the drop-down menu on the field with the table calculation icon, and do one of the following:

• Change the Compute Using option: Allows you to change the computation from the default to another option, for example, Table (Down) or Pane (Down). Options are contextual.

Edit Table Calculation: Opens the table calculation dialog box, which has more editing options.

Practice: Running Total of Sales

You have a crosstab that shows yearly sales broken down by category and quarter. Add a running total by quarter, and restart the total for each category. Then use your crosstab to look up specific running totals.

Directions:

Open Running_Total_of_Sales_Starter.twbx and create a view according to the following specification:

1. Drag Customer Segment, Order Date (set discrete quarter) to Rows 2. Drag Order Date (discrete year) to Columns

3. Drag Sales to Text Label

4. Edit Sales on Text Label, right click and Quick Table Calculation choose Running Total, right click one more time then select Compute Using, choose Pane (down).

5. From measure, drag Sales to the view then place it right before Running Total.

6. Save the workbook.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Practice: Year over Year Change

Create a bar chart that uses color to show the percent difference in year over year sales. Add filters to the view for region and category so you can quickly compare the growth of table products within different region.

Directions:

Open Year_over_Year_Change_Starter.twbx and create a view according to the following specification:

1. From Dimension, drag and drop Order Date to Columns.

2. From Measure, drag and drop Sales to Rows.

3. Change the Mark Type to Bar.

4. Right Click on Sales and select Quick Table Calculation > Year over Year Growth.

5. Show the amount of change year over year using color.

6. Show a Single Value filter for Region and filter to see only Asia Pac.

7. Show a Multiple Value (dropdown) filter for Category and filter to see only Tables.

8. Drag another instance of Sales to Label.

9. Set the Null values to show at the default position.

CONFIDENTIAL DO NOT COPY

CYBERTREND DATA ACADEMY

Dalam dokumen Introduction to Data Visualization (Halaman 118-123)

Dokumen terkait