1. Retrieve the sales dataset available in https://www.kaggle.
com/datasets/kyanyoga/sample-
sales-data in tableau and implements 1 and 2.
i. Create a bar chart to compare sales across different product categories. Use color coding to
highlight the highest and lowest sales categories.
ii. Use a line chart to plot monthly sales over time. Highlight any seasonal trends or significant
peaks.
iii. Create a heatmap to compare profit margins across products or categories. Use color gradients
to differentiate between high and low-margin items.
To visualize the sales dataset from Kaggle in Tableau and implement your requested charts,
follow these steps:
Step 1: Download and Prepare the Dataset
1. Download the dataset from Kaggle.
2. Load the data into Tableau.
Step 2: Create Visualizations
i. Bar Chart for Sales by Product Category
1. Drag "Product Category" to the Rows shelf.
2. Drag "Sales" to the Columns shelf.
3. Change the chart type to a bar chart if it’s not selected by default.
4. Color Code:
o Click on the "Sales" field on the Marks card.
o Select "Color" and then choose "Diverging" to highlight the highest and
lowest sales categories.
o Adjust the color scheme to make it visually distinct.
ii. Line Chart for Monthly Sales Over Time
1. Create a Date Field: Drag "Order Date" to the Columns shelf and choose "Month"
for aggregation.
2. Drag "Sales" to the Rows shelf.
3. Change the chart type to a line chart if needed.
4. Highlight Seasonal Trends:
o Add reference lines or annotations to highlight significant peaks.
o You can also use a moving average to smooth out fluctuations.
iii. Heatmap for Profit Margins
1. Create a New Sheet.
2. Drag "Product Category" to the Rows shelf and "Product Name" or another
relevant dimension to the Columns shelf.
3. Drag "Profit Margin" (if it’s not available, calculate it as (Sales - Cost) /
Sales) to the Color shelf.
4. Adjust the Color Gradient: Use a diverging or sequential color scheme to indicate
high and low profit margins.
2. Create a dashboard that segments customers based on purchase frequency, average order
value,
and total revenue. Use clustering or grouping features in Tableau to identify different customer
segments.
ii. Use Tableau's forecasting feature to predict future sales based on historical trends. Display the
forecast in a line chart alongside past sales data.
Step 1: Prepare the Data
1. Load the Sales Data: Ensure you have the sales dataset loaded into Tableau.
2. Create Calculated Fields:
o Purchase Frequency: Count of orders per customer.
sql
Copy code
COUNT([Order ID])
o Average Order Value (AOV): Total sales divided by the number of orders.
sql
Copy code
SUM([Sales]) / COUNT([Order ID])
o Total Revenue: Total sales per customer.
sql
Copy code
SUM([Sales])
Step 2: Segment Customers
1. Create a New Worksheet.
2. Drag "Customer ID" to Rows.
3. Add the Calculated Fields:
o Drag your "Purchase Frequency," "Average Order Value," and "Total
Revenue" to the Columns shelf.
4. Create Clusters:
o Select all three fields.
o Go to the "Analytics" pane and drag the "Cluster" option onto the worksheet.
o Tableau will suggest clusters based on your data. Adjust the number of
clusters as necessary to fit your analysis.
Step 3: Create the Customer Segmentation Dashboard
1. Create a New Dashboard.
2. Drag the Customer Segmentation Worksheet onto the dashboard.
3. Add Filters: Consider adding filters for dimensions like "Region" or "Product
Category" to allow users to segment data dynamically.
Step 4: Forecast Future Sales
1. Create Another Worksheet for Forecasting.
2. Drag "Order Date" to the Columns shelf (use month or quarter granularity).
3. Drag "Sales" to the Rows shelf.
4. Create the Forecast:
o Click on the "Analytics" pane, then drag the "Forecast" option onto the chart.
o Tableau will automatically generate a forecast based on historical sales data.
5. Adjust Forecast Settings:
o Right-click on the forecasted area to customize settings such as the forecast
length and confidence intervals.
Step 5: Combine into a Dashboard
1. Go back to your Dashboard.
2. Add the Forecasting Worksheet.
3. Arrange and Size: Position both visualizations (customer segments and sales
forecast) for a coherent layout.
4. Add Titles and Annotations: Provide context to each visualization.
3. Retrieve the market basket analysis dataset available in
https://www.kaggle.com/datasets/aslanahmedov/market-basket-analysis in tableau and
implement 3,4 and 5.
i. Create a bar chart or tree map in Tableau to show the top 10 items based on the frequency of
purchases.
ii. Use a heatmap or matrix to visualize the co-occurrence of items in transactions, showing the
most common pairs of items bought together.
iii. Identify frequent item sets and visualize them using a tree map or a bar chart, showing the most
common bundles of items purchased together.
To perform market basket analysis using the dataset from Kaggle and implement your
specified visualizations in Tableau, follow these steps:
Step 1: Download and Prepare the Dataset
1. Download the dataset from Kaggle.
2. Load the data into Tableau. Typically, you will have a CSV file that contains
transaction data.
Step 2: Data Preparation
Before you create visualizations, you may need to perform some data preparation:
Ensure proper data structure: The dataset should ideally be in a long format with at
least two columns: Transaction ID and Item.
Clean the data if necessary (e.g., remove duplicates, handle missing values).
Step 3: Create Visualizations
i. Bar Chart or Tree Map for Top 10 Items
1. Create a New Worksheet.
2. Count Item Frequencies:
o Drag the Item dimension to the Rows shelf.
o Drag the Item dimension again to the Columns shelf and set it to Count
(right-click > Measure > Count).
3. Sort Items:
o Sort the items in descending order by count.
4. Filter for Top 10:
o Right-click on the item count field in the Rows shelf and select "Filter".
o Set the filter to show only the top 10 items based on the count.
5. Create the Bar Chart or Tree Map:
o For a bar chart, ensure the chart type is set to Bar.
o For a tree map, you can change the visualization type to Tree Map in the
“Show Me” panel.
ii. Heatmap or Matrix for Co-occurrence
1. Create a New Worksheet.
2. Create a Cross Tab:
o Drag Item to both the Rows and Columns shelves to create a matrix.
3. Count Co-occurrences:
o Drag the Item field again to the center of the matrix and set it to Count.
4. Convert to Heatmap:
o Change the chart type to Heat Map using the “Show Me” panel.
5. Color the Heatmap:
o Drag the count measure to the Color shelf to visually differentiate between
low and high co-occurrences.
iii. Identify Frequent Item Sets
1. Create a New Worksheet.
2. Use the "Item" Field:
o Similar to the co-occurrence matrix, create a cross-tab of Item with
Transaction ID (or the equivalent).
3. Count Bundles:
o You may need to create calculated fields or use Tableau’s data blending
feature to identify combinations. You can use a tool like the Apriori algorithm
for item sets and import the results into Tableau.
4. Visualize Frequent Item Sets:
o For visualization, use a bar chart or tree map to show the counts of these
bundles.
o Drag the calculated field representing the bundle to the Rows shelf and count
the occurrences.
Step 4: Combine into a Dashboard (Optional)
1. Create a New Dashboard.
2. Drag your worksheets for top items, co-occurrence heatmap, and frequent item sets
onto the dashboard.
3. Adjust Layout: Arrange the charts for clarity and usability.