Tableau Lesson 54 – Retail Analysis | Dataplexa
Section IV — Lesson 54

Retail Analysis Project

Retail dashboards track product performance, store comparisons, seasonal patterns, and customer basket behaviour. This project builds a complete retail analytics dashboard from a single transactions table — covering five business questions with seven calculated fields and five views assembled into one interactive dashboard.

The Dataset

A 32-row transactions table spanning two seasons across three stores and four product categories. Save as retail_data.csv.

retail_data.csv
Txn_ID,Store,Season,Category,Product,Units_Sold,Revenue,Cost,Discount_Pct
T001,North,Spring,Apparel,Jackets,42,8820,5040,0.05
T002,North,Spring,Footwear,Trainers,38,7600,4560,0.10
T003,North,Spring,Accessories,Bags,61,3660,1830,0.00
T004,North,Spring,Electronics,Headphones,29,8700,5510,0.05
T005,South,Spring,Apparel,Jackets,35,7350,4200,0.05
T006,South,Spring,Footwear,Trainers,44,8800,5280,0.10
T007,South,Spring,Accessories,Bags,72,4320,2160,0.00
T008,South,Spring,Electronics,Headphones,31,9300,5890,0.05
T009,Central,Spring,Apparel,Jackets,28,5880,3360,0.05
T010,Central,Spring,Footwear,Trainers,33,6600,3960,0.10
T011,Central,Spring,Accessories,Bags,55,3300,1650,0.00
T012,Central,Spring,Electronics,Headphones,22,6600,4180,0.05
T013,North,Summer,Apparel,T-Shirts,88,6160,3520,0.00
T014,North,Summer,Footwear,Sandals,74,5920,3552,0.10
T015,North,Summer,Accessories,Sunglasses,95,9500,4750,0.00
T016,North,Summer,Electronics,Speakers,41,12300,7380,0.05
T017,South,Summer,Apparel,T-Shirts,102,7140,4080,0.00
T018,South,Summer,Footwear,Sandals,89,7120,4272,0.10
T019,South,Summer,Accessories,Sunglasses,110,11000,5500,0.00
T020,South,Summer,Electronics,Speakers,48,14400,8640,0.05
T021,Central,Summer,Apparel,T-Shirts,76,5320,3040,0.00
T022,Central,Summer,Footwear,Sandals,62,4960,2976,0.10
T023,Central,Summer,Accessories,Sunglasses,84,8400,4200,0.00
T024,Central,Summer,Electronics,Speakers,37,11100,6660,0.05
T025,North,Autumn,Apparel,Coats,55,16500,9900,0.00
T026,North,Autumn,Footwear,Boots,48,14400,8640,0.05
T027,South,Autumn,Apparel,Coats,61,18300,10980,0.00
T028,South,Autumn,Footwear,Boots,52,15600,9360,0.05
T029,Central,Autumn,Apparel,Coats,44,13200,7920,0.00
T030,Central,Autumn,Footwear,Boots,39,11700,7020,0.05
T031,North,Autumn,Accessories,Scarves,68,6800,3400,0.00
T032,South,Autumn,Accessories,Scarves,73,7300,3650,0.00

The Five Business Questions

# Business Question Technique Chart
Q1 Which categories and stores drive the most revenue? Revenue by Store + Category (stacked bar) Stacked bar chart
Q2 How does profit margin compare across categories? Gross Margin % (basic calc) Horizontal bar with reference line
Q3 How does revenue shift across seasons? Season as dimension + % of Total (FIXED LOD) Area chart
Q4 Which products have the highest revenue per unit? Revenue per Unit + Units Sold on Size Scatter plot
Q5 Does discounting hurt margin — and which store discounts most? Avg Discount % + Margin by Store (FIXED LOD) Dual-axis combo

Step 1 — Connect and Prepare

1
Connect to retail_data.csv. Verify types: Units_Sold, Revenue, Cost as Number (decimal), Discount_Pct as Number (decimal), all others as String.
2
Sort Season manually: right-click Season in the Data pane → Default Properties → Sort → Manual → order: Spring, Summer, Autumn. This ensures charts read chronologically rather than alphabetically.
3
Create an extract: Data → Extract Data → Extract. Rename the data source to Retail Data.

Step 2 — Build the Calculated Fields

Calc 1 — Gross Profit
SUM([Revenue]) - SUM([Cost])
Calc 2 — Gross Margin %
(SUM([Revenue]) - SUM([Cost])) / SUM([Revenue])
Calc 3 — Revenue per Unit
SUM([Revenue]) / SUM([Units_Sold])
Calc 4 — % of Total Revenue (FIXED LOD)
SUM([Revenue]) / {FIXED : SUM([Revenue])}
Grand total denominator — ignores all view filters and dimensions. Used on the area chart to show each season's share of total annual revenue.
Calc 5 — Avg Discount by Store (FIXED LOD)
{FIXED [Store] : AVG([Discount_Pct])}
Calc 6 — Margin by Store (FIXED LOD)
{FIXED [Store] :
  (SUM([Revenue]) - SUM([Cost])) / SUM([Revenue])
}
Locks margin to Store level — stays correct on the discount combo chart even if a Category filter is applied by the user.
Calc 7 — Discount Impact Flag
IF [Discount_Pct] > 0.05 THEN "Heavy Discount"
ELSEIF [Discount_Pct] > 0 THEN "Light Discount"
ELSE "No Discount"
END
Segments transactions by discount intensity. Used to colour the scatter plot to reveal whether heavily discounted products still achieve strong revenue per unit.

Set default formats: Gross Margin % → Percentage 1dp. Revenue per Unit → Currency $#,##0. % of Total Revenue → Percentage 1dp. Avg Discount by Store → Percentage 1dp.

Step 3 — Chart 1: Revenue by Store and Category (Q1)

1
New sheet. Drag Store to Columns and Revenue to Rows. Mark type: Bar. Sort descending by Revenue.
2
Drag Category to the Colour shelf — bars split into four colour-coded segments. Set colours: Apparel #0ea5e9, Footwear #f97316, Accessories #22c55e, Electronics #a855f7. Drag Revenue to Label.
3
Format Revenue axis as $#,##0,\K. Title: South Leads in Revenue — Electronics and Apparel Drive All Three Stores. Tab: Revenue by Store.
Revenue by Store — expected pattern
South Leads in Revenue — Electronics and Apparel Drive All Three Stores South Electronics $23.7K Apparel $25.4K Footwear $30.7K Access. $22.6K North Central

Step 4 — Chart 2: Gross Margin by Category (Q2)

1
New sheet. Drag Category to Rows and Gross Margin % to Columns. Mark type: Bar. Sort descending.
2
Drag Gross Margin % to Colour. Use the same category colours from Chart 1 — right-click Colour → Edit Colours → match manually. Add Gross Margin % to Label shelf. Format axis as Percentage 0dp.
3
Add a reference line at 0.45 → label "Target: 45%". Title: Accessories Have the Best Margin — Footwear Just Below Target. Tab: Margin by Category.

Step 5 — Chart 3: Revenue Share by Season (Q3)

1
New sheet. Drag Season to Columns (sort order: Spring → Summer → Autumn) and Revenue to Rows. Mark type: Area. Colour: #0ea5e9 with 60% opacity.
2
Add % of Total Revenue to the Label shelf — labels each season with its share of all annual revenue. Add Revenue to Tooltip. Format axis as $#,##0,\K.
3
Title: Summer Is Peak Season at 41% of Annual Revenue. Tab: Seasonal Revenue.
Seasonal revenue area chart
Summer Is Peak Season at 41% of Annual Revenue Spring Summer Autumn 27% 41% 32%

Step 6 — Chart 4: Revenue per Unit Scatter Plot (Q4)

1
New sheet. Drag Revenue per Unit to Columns and Gross Margin % to Rows. Drag Product to Detail. Drag Units_Sold to Size — larger circles = more units sold.
2
Drag Discount Impact Flag to Colour: No Discount = #22c55e, Light Discount = #f97316, Heavy Discount = #ef4444. Drag Product to Label.
3
Format x-axis as $#,##0. Format y-axis as Percentage 0dp. Title: Coats: Highest Revenue per Unit — Sunglasses: Best Margin at High Volume. Tab: Product Performance.

Step 7 — Chart 5: Discount vs Margin by Store (Q5)

1
New sheet. Drag Store to Columns. Drag Avg Discount by Store to Rows. Mark type: Bar. Colour: #f97316.
2
Add Margin by Store to Rows as a second measure. Right-click → Dual Axis → Synchronise Axes. Change the Margin mark type to Line with circle markers, colour #0ea5e9. This reveals whether higher discount stores show lower margins.
3
Add Avg Discount % and Margin % to Labels. Format both as Percentage 1dp. Title: North Discounts Most — but All Stores Maintain Similar Margins. Tab: Discount vs Margin.

Step 8 — Assemble the Dashboard

1
New dashboard → Automatic size → background #f8fafc. Title: Retail Performance Dashboard — 3 Stores × 3 Seasons, 22pt bold.
2
Row 1 (Horizontal): Revenue by Store stacked bar (left 55%) + Margin by Category (right 45%).
3
Row 2 (Horizontal): Seasonal Revenue area chart (left 40%) + Product Performance scatter (right 60%).
4
Row 3: Discount vs Margin combo — full width. Add a Category filter applied to all sheets using this data source. Dashboard filter action: clicking a Store bar in Row 1 filters all other views. Set all container Outer Padding to 6.
📌 Teacher's Note

The Discount vs Margin chart is a classic management chart — it answers whether the discounting strategy is actually hurting the business. The dual-axis approach is perfect here because discount rate and margin rate are both percentages on similar scales, so synchronising the axes makes the comparison honest. If you find all three stores have similar margins despite different discount levels, the story is that discounting is being absorbed by volume gains rather than margin erosion — a reassuring finding for the sales team but worth watching in future seasons.

Practice Questions

1. The Season field is a string, so Tableau sorts it alphabetically by default. How do you force it into chronological order, and what goes wrong on the area chart if you skip this step?

2. The Discount Impact Flag field classifies each transaction into three tiers. How is it built and what does it reveal on the scatter plot?

3. Chart 5 uses Margin by Store (FIXED LOD) rather than the plain Gross Margin % calculated field. Why does this matter when a Category filter is applied on the dashboard?

Quiz

1. The product scatter plot encodes three variables at once. Which shelf carries the third variable — units sold — and what does it show?


2. The % of Total Revenue field uses a FIXED LOD with an empty dimension. What does the empty FIXED return and why is this the correct denominator for a season share calculation?


3. Chart 5 overlays a margin line on top of discount bars for the same three stores. What is the exact sequence of steps in Tableau to achieve this combined chart?


Next up — Lesson 55: Marketing Analysis Project — building a campaign performance dashboard covering channel attribution, conversion funnels, cost per acquisition, and ROI comparisons across marketing spend.