0
0
Tableaubi_tool~15 mins

LOD with date dimensions in Tableau - Real Business Scenario

Choose your learning style9 modes available
Scenario Mode
👤 Your Role: You are a sales analyst at a retail company.
📋 Request: Your manager wants to see the total sales per month and also the average daily sales within each month for the past year.
📊 Data: You have sales transaction data with columns: Order Date, Sales Amount, and Order ID.
🎯 Deliverable: Create a Tableau dashboard showing monthly total sales and average daily sales per month using LOD expressions with date dimensions.
Progress0 / 7 steps
Sample Data
Order DateOrder IDSales Amount
2023-01-051001150
2023-01-051002200
2023-01-151003100
2023-02-101004300
2023-02-151005250
2023-02-151006100
2023-03-011007400
2023-03-201008350
2023-03-201009150
2023-03-251010200
1
Step 1: Create a calculated field to extract the month and year from Order Date for grouping.
Create calculated field 'Month Year' with formula: DATETRUNC('month', [Order Date])
Expected Result
A new field showing the first day of each month for each order date, e.g., 2023-01-01, 2023-02-01.
2
Step 2: Create a calculated field for total sales per month using LOD expression.
{FIXED [Month Year] : SUM([Sales Amount])}
Expected Result
Total sales aggregated for each month, e.g., January total sales = 450.
3
Step 3: Create a calculated field to count distinct days with sales in each month using LOD expression.
{FIXED [Month Year] : COUNTD([Order Date])}
Expected Result
Number of unique sales days per month, e.g., January has 2 unique sales days.
4
Step 4: Create a calculated field for average daily sales per month by dividing total sales by distinct sales days.
[Total Sales per Month] / [Distinct Sales Days per Month]
Expected Result
Average daily sales for each month, e.g., January average daily sales = 225.
5
Step 5: Build a dashboard with a bar chart showing 'Month Year' on X-axis and 'Total Sales per Month' on Y-axis.
Use 'Month Year' as Columns, 'Total Sales per Month' as Rows in a bar chart.
Expected Result
Bar chart showing total sales for each month.
6
Step 6: Add a line chart on the same dashboard showing 'Month Year' on X-axis and 'Average Daily Sales per Month' on Y-axis.
Use 'Month Year' as Columns, 'Average Daily Sales per Month' as Rows in a line chart.
Expected Result
Line chart showing average daily sales trend per month.
7
Step 7: Combine both charts in a dashboard with clear titles and legends for easy comparison.
Arrange bar and line charts vertically with titles: 'Monthly Total Sales' and 'Average Daily Sales per Month'.
Expected Result
Dashboard clearly showing monthly total sales and average daily sales side by side.
Final Result
Monthly Sales Dashboard

Month Year | Total Sales (Bar)  | Average Daily Sales (Line)
------------------------------------------------------------
2023-01    | ██████████ 450     | ────────225
2023-02    | ██████████████ 650 | ──────────217
2023-03    | ██████████████████ 1100 | ──────────275

(Bar length proportional to total sales, line shows average daily sales trend)
March had the highest total sales with 1100.
Average daily sales ranged from 217 to 275 per day.
January had 2 sales days, February had 3, and March had 4.
Bonus Challenge

Create a calculated field to show the percentage contribution of each month's total sales to the yearly total sales using LOD.

Show Hint
Use FIXED LOD to calculate yearly total sales: {FIXED : SUM([Sales Amount])} and then divide monthly total sales by this value.