Question 1
Report
Use the following login credentials to sign in
to the virtual machine:
Username: Admin
Password:
The following information is for technical support purposes only:
Lab Instance: 40201223
To access Tableau Help, you can open the Help.pdf file on the desktop.
From the desktop, open the CC workbook.
Open the Categorical Sales worksheet.
You need to use table calculations to compute the following:
For each category and year, calculate the average sales by segment.
Create another calculation to compute the year-over-year percentage change of the average sales by category calculation. Replace the original measure with the yearover- year percentage change in the crosstab.
From the File menu in Tableau Desktop, click Save.
Username: Admin
Password:
The following information is for technical support purposes only:
Lab Instance: 40201223
To access Tableau Help, you can open the Help.pdf file on the desktop.
From the desktop, open the CC workbook.
Open the Categorical Sales worksheet.
You need to use table calculations to compute the following:
For each category and year, calculate the average sales by segment.
Create another calculation to compute the year-over-year percentage change of the average sales by category calculation. Replace the original measure with the yearover- year percentage change in the crosstab.
From the File menu in Tableau Desktop, click Save.
Correct answer:
Explanation:
1. Open the workbook
Launch Tableau Desktop on the VM.
Open the file named CC.twb(x) on the desktop.
Open the worksheet Categorical Sales.
Part 1 — Compute Average Sales by Segment (per Category and Year)
Step 1: Build the basic view
Drag Category to Rows.
Drag Year(Order Date) (discrete, blue YEAR) to Rows to the right of Category.
Drag Segment to Columns.
Drag Sales to Text (Marks card).
This creates a crosstab of Sales by Category → Year → Segment.
Step 2: Convert Sales to Average Sales
You need a table calculation to compute average sales by segment per category and year.
Right-click the SUM(Sales) pill.
Select Quick Table Calculation → Average
(or manually create a calculated field if instructions require).
Important: If the instructions expect an explicit calculation instead of the quick table calc:
Create a new field:
WINDOW_AVG( SUM([Sales]) )
Then set Compute Using → Segment or Table Across depending on layout.
The value should now show average sales per segment for each Category + Year.
Part 2 — Compute YoY % Change of the Average Sales
Now you must compute year-over-year % change of that average sales table calculation.
Step 1: Create the YoY Calculation
Create a new calculated field:
Calculation: YoY % Change
Then set Compute Using → Segment or Table Across depending on layout.
The value should now show average sales per segment for each Category + Year.
Step 2: Create the YoY Calculation
Create a new calculated field:
Calculation: YoY % Change
(SUM([Sales]) - LOOKUP(SUM([Sales]), -1))
/
LOOKUP(SUM([Sales]), -1)
If you used WINDOW_AVG before, the YoY calc becomes:
(WINDOW_AVG(SUM([Sales])) - LOOKUP(WINDOW_AVG(SUM([Sales])), -1))
/
LOOKUP(WINDOW_AVG(SUM([Sales])), -1)
Step 2: Add the calculation to the view
Drag the new YoY % Change field onto Text (replace the existing value).
Right-click the field → Edit Table Calculation.
Step 3: Set Compute Using
Set Compute Using → Table Down (or Year) so the calculation compares each row’s year with the previous year.
You should now see YoY % change values for each Category × Segment.
3. Replace the Original Measure
The instructions say:
“Replace the original measure with the year-over-year percentage change in the crosstab.”
You have already done this by replacing the Text field with YoY % Change.
4. Save the Workbook
Go to File → Save.
You’re done.
Final Answer (Short Form)
Use a table calculation for average sales (WINDOW_AVG), then create a second table calculation using LOOKUP() to compute year-over-year % change, set the table calculation direction to Table Down, place it on the crosstab, and save the workbook.
1. Open the workbook
Launch Tableau Desktop on the VM.
Open the file named CC.twb(x) on the desktop.
Open the worksheet Categorical Sales.
Part 1 — Compute Average Sales by Segment (per Category and Year)
Step 1: Build the basic view
Drag Category to Rows.
Drag Year(Order Date) (discrete, blue YEAR) to Rows to the right of Category.
Drag Segment to Columns.
Drag Sales to Text (Marks card).
This creates a crosstab of Sales by Category → Year → Segment.
Step 2: Convert Sales to Average Sales
You need a table calculation to compute average sales by segment per category and year.
Right-click the SUM(Sales) pill.
Select Quick Table Calculation → Average
(or manually create a calculated field if instructions require).
Important: If the instructions expect an explicit calculation instead of the quick table calc:
Create a new field:
WINDOW_AVG( SUM([Sales]) )
Then set Compute Using → Segment or Table Across depending on layout.
The value should now show average sales per segment for each Category + Year.
Part 2 — Compute YoY % Change of the Average Sales
Now you must compute year-over-year % change of that average sales table calculation.
Step 1: Create the YoY Calculation
Create a new calculated field:
Calculation: YoY % Change
Then set Compute Using → Segment or Table Across depending on layout.
The value should now show average sales per segment for each Category + Year.
Step 2: Create the YoY Calculation
Create a new calculated field:
Calculation: YoY % Change
(SUM([Sales]) - LOOKUP(SUM([Sales]), -1))
/
LOOKUP(SUM([Sales]), -1)
If you used WINDOW_AVG before, the YoY calc becomes:
(WINDOW_AVG(SUM([Sales])) - LOOKUP(WINDOW_AVG(SUM([Sales])), -1))
/
LOOKUP(WINDOW_AVG(SUM([Sales])), -1)
Step 2: Add the calculation to the view
Drag the new YoY % Change field onto Text (replace the existing value).
Right-click the field → Edit Table Calculation.
Step 3: Set Compute Using
Set Compute Using → Table Down (or Year) so the calculation compares each row’s year with the previous year.
You should now see YoY % change values for each Category × Segment.
3. Replace the Original Measure
The instructions say:
“Replace the original measure with the year-over-year percentage change in the crosstab.”
You have already done this by replacing the Text field with YoY % Change.
4. Save the Workbook
Go to File → Save.
You’re done.
Final Answer (Short Form)
Use a table calculation for average sales (WINDOW_AVG), then create a second table calculation using LOOKUP() to compute year-over-year % change, set the table calculation direction to Table Down, place it on the crosstab, and save the workbook.
