Tableau Lesson 51 – Sales Analysis Project | Dataplexa
Section IV — Lesson 51

Sales Analysis Project

This project applies calculations, table calculations, LOD expressions, filters, and dashboard design together in one end-to-end build. You will analyse a sales dataset to answer four business questions and present the findings in a single interactive dashboard.

The Dataset

Save the content below as sales_analysis.csv and connect via Text File in Tableau Desktop.

sales_analysis.csv
Order ID,Order Date,Ship Date,Customer Segment,Region,Category,Sub-Category,Product,Sales,Profit,Quantity,Discount
S-001,2024-01-08,2024-01-12,Consumer,East,Technology,Phones,Phone A,1820,364,2,0.0
S-002,2024-01-15,2024-01-19,Corporate,West,Furniture,Chairs,Chair B,940,94,3,0.0
S-003,2024-01-22,2024-01-25,Consumer,East,Office Supplies,Binders,Binder C,210,42,5,0.1
S-004,2024-02-03,2024-02-07,Home Office,South,Technology,Accessories,Accessory D,580,116,4,0.0
S-005,2024-02-16,2024-02-20,Consumer,West,Office Supplies,Paper,Paper E,130,39,10,0.0
S-006,2024-02-22,2024-02-25,Corporate,East,Technology,Phones,Phone F,2100,420,2,0.0
S-007,2024-03-04,2024-03-09,Consumer,Central,Furniture,Tables,Table G,1200,-60,1,0.2
S-008,2024-03-12,2024-03-16,Corporate,West,Technology,Laptops,Laptop H,3400,680,1,0.0
S-009,2024-03-20,2024-03-23,Home Office,South,Office Supplies,Labels,Label I,90,27,8,0.0
S-010,2024-04-02,2024-04-06,Consumer,East,Furniture,Chairs,Chair J,860,86,2,0.0
S-011,2024-04-09,2024-04-13,Corporate,Central,Technology,Accessories,Accessory K,470,94,3,0.1
S-012,2024-04-23,2024-04-27,Consumer,West,Office Supplies,Binders,Binder L,190,38,4,0.0
S-013,2024-05-06,2024-05-10,Corporate,East,Technology,Laptops,Laptop M,2900,580,1,0.0
S-014,2024-05-15,2024-05-19,Home Office,South,Furniture,Bookcases,Bookcase N,760,-38,2,0.2
S-015,2024-05-21,2024-05-24,Consumer,West,Technology,Phones,Phone O,1650,330,2,0.0
S-016,2024-06-03,2024-06-07,Corporate,Central,Office Supplies,Paper,Paper P,150,45,12,0.0
S-017,2024-06-11,2024-06-15,Consumer,East,Furniture,Tables,Table Q,1100,-55,1,0.2
S-018,2024-06-19,2024-06-22,Home Office,West,Technology,Accessories,Accessory R,620,124,5,0.0
S-019,2024-06-26,2024-06-29,Consumer,South,Office Supplies,Binders,Binder S,240,48,6,0.1
S-020,2024-06-30,2024-07-03,Corporate,Central,Technology,Laptops,Laptop T,3100,620,1,0.0

The Four Business Questions

Each sheet answers one specific question. Build each sheet in order before assembling the dashboard.

Sheet Business Question Key Technique Chart Type
1. Discount Impact Do discounts hurt profit margin? Scatter plot + trend line Scatter
2. Segment Performance Which customer segment is most profitable? FIXED LOD — % of total profit Horizontal bar
3. Running Total How does cumulative sales build through the year? Quick Table Calculation — Running Total Area chart
4. Ship Lag How many days between order and shipment per region? DATEDIFF calculated field Box plot

Step 1 — Connect and Prepare

1
Connect → Text File → select sales_analysis.csv. Verify: Order Date and Ship Date as Date, Sales/Profit/Quantity/Discount as Number (decimal), all text columns as String.
2
Create the extract: Data → Extract Data → Extract. All four sheets run against the .hyper file.
3
Create these two calculated fields before building any sheets — both are reused across multiple views.
Calculated field: Profit Margin
SUM([Profit]) / SUM([Sales])
Calculated field: Ship Lag (days)
DATEDIFF('day', [Order Date], [Ship Date])

Step 2 — Sheet 1: Discount Impact

This scatter plot tests whether higher discounts correlate with lower profit margins — a common sales analysis question.

1
New sheet. Drag Discount to Columns and Profit Margin to Rows. Drag Order ID to the Detail shelf to disaggregate — one mark per order.
2
Drag Category to Colour. Edit colours: Technology = #0ea5e9, Furniture = #f97316, Office Supplies = #22c55e.
3
Analysis menu → Trend Lines → Show Trend Lines. Right-click the trend line → Edit Trend Line → Linear, Per Pane. This draws one trend line across all categories.
4
Format Profit Margin axis as Percentage (1dp). Format Discount axis as Percentage (0dp). Title: Higher Discounts Compress Profit Margin. Rename tab Discount Impact.
Discount Impact — expected result
Higher Discounts Compress Profit Margin 25% 15% 5% -5% 0% 10% 20% Discount Technology Furniture Office Supplies

Step 3 — Sheet 2: Segment Performance

This sheet uses a FIXED LOD to calculate each segment's share of total profit — a percentage that stays correct even when the view is filtered by Region or Category.

Calculated field: Segment % of Total Profit
SUM([Profit]) / {FIXED : SUM([Profit])}

The FIXED with no dimension computes total profit across the entire dataset. Dividing each segment's SUM(Profit) by this gives the true share — independent of any view-level filters applied on the dashboard.

1
New sheet. Drag Customer Segment to Rows and Segment % of Total Profit to Columns. Sort descending.
2
Drag Segment % of Total Profit to the Label shelf. Format as Percentage (1dp). Set bar colour to #7c3aed.
3
Remove grid lines. Title: Corporate Drives 57% of Total Profit. Rename tab Segment Performance.

Step 4 — Sheet 3: Running Total

A running total shows how cumulative sales build through the year — useful for tracking progress toward an annual target.

1
New sheet. Drag Order Date to Columns → right-click → Month (discrete). Drag Sales to Rows.
2
Right-click the SUM(Sales) pill on Rows → Quick Table Calculation → Running Total. The axis now shows cumulative sales across months.
3
Change the mark type to Area. Set colour to #0ea5e9 with 60% opacity. Title: Cumulative Sales Reached $24K by End of June. Rename tab Running Total.
4
Format the Sales axis as $#,##0. Add data labels to the first (Jan) and last (Jun) marks only using Mark → Label → Min/Max.
Running Total — expected result
Cumulative Sales Reached $24K by End of June $25K $15K $5K Jan Feb Mar Apr May Jun $2.9K $24.3K

Step 5 — Sheet 4: Ship Lag

A box plot of shipping lag by region shows whether some regions are consistently slower to ship and how much variability exists.

1
New sheet. Drag Region to Columns and Ship Lag (days) to Rows. Change mark type to Circle. Drag Order ID to Detail to get one circle per order.
2
Analysis menu → Box Plot. Tableau overlays the box plot summary on the individual marks. Set circle colour to #94a3b8 at 60% opacity, box colour to #0f172a.
3
Title: Central Has the Longest Average Ship Lag. Rename tab Ship Lag.

Step 6 — Build the Analysis Dashboard

1
New dashboard. Size: Automatic. Background: #f8fafc. Title text object: Sales Analysis — H1 2024, 22pt bold.
2
Outer Vertical container → two Horizontal containers. Top row: Discount Impact left, Segment Performance right. Bottom row: Running Total left, Ship Lag right. 50/50 width split on each row.
3
Add a Customer Segment quick filter. Set Apply to All Worksheets Using This Data Source. Place above the top row. Style: Multiple Values (list) — only 3 values so a list fits well.
4
Set Outer Padding to 6px on all containers. Give each chart a white background and a 1px #e2e8f0 border via the Layout pane for a card appearance.
Finished analysis dashboard — wireframe
Sales Analysis — H1 2024 Segment: ☑ Consumer ☑ Corporate ☑ Home Office Higher Discounts Compress Profit Margin Corporate Drives 57% of Total Profit 57% 36% 7% Corporate Consumer Home Office Cumulative Sales Reached $24K by June Central Has Longest Average Ship Lag Central East South West
📌 Teacher's Note

The FIXED LOD on the Region Share chart is worth understanding deeply. Without it, filtering the dashboard by Category would change the denominator — each region's share would shift based on which category is selected, which is misleading. The FIXED anchors the grand total to the full dataset regardless of view filters, so percentages always reflect the true company-wide share. Build this pattern once and you will reach for it constantly.

Practice Questions

1. Write the calculated field formula that computes the number of days between Order Date and Ship Date for each order.

2. Write the LOD formula for Segment % of Total Profit, and explain why a plain percentage quick table calculation gives wrong results when the view is filtered by Region.

3. The monthly Sales chart needs to show a cumulative running total. What are the steps to apply this without writing a new calculated field?

Quiz

1. The Discount Impact scatter plot needs one mark per order. How do you disaggregate the view to achieve this?


2. The Running Total chart uses an Area mark type instead of a Line. What visual advantage does the filled area provide for a cumulative trend?


3. The Discount Impact scatter plot has Category on the Colour shelf but needs a single trend line across all categories. How is this configured?


Next up — Lesson 52: Financial Analysis Project — building a profit and loss dashboard with variance calculations, budget vs actual comparisons, and waterfall charts.