Beer sales experience fluctuations throughout the year, with a notable spike during St. Patrick’s Day. This analysis explores sales trends, key customer demographics, and product pairings to help Regork optimize pricing, promotions, and inventory strategies.
Using the Complete Journey dataset for 2017, we analyzed beer sales trends before, during, and after St. Patrick’s Day. We compared sales across major holidays, examined demographic purchasing behavior by age and income, and identified complementary items bought with beer. Data was processed using R, and visualizations were created to highlight key trends.
Beer sales peak on St. Patrick’s Day, with elevated purchases in the days leading up to it. Sales on this holiday rival those of the Super Bowl and Independence Day. The 30-44 age group and households earning $50K-$75K contribute the most to beer sales. Customers frequently buy snacks, soft drinks, and dairy products alongside beer, with demand for these items remaining high even after St. Patrick’s Day.
Regork should focus marketing efforts on mid-income consumers aged 30-44, offering beer and snack bundle promotions before and during St. Patrick’s Day. Increasing beer inventory a week in advance and ensuring complementary products are well-stocked will help meet demand. A dynamic pricing strategy, with small price increases before the holiday and loyalty discounts after, can further boost revenue.
library(completejourney)
library(tidyverse)
library(stringr)
library(lubridate)
library(ggplot2)
transactions <- get_transactions()
products <- products
demographics <- demographics
data <- transactions %>%
left_join(products, by = "product_id")
beer_sales <- data %>%
filter(str_detect(tolower(department), "beer") | str_detect(tolower(product_category), "beer"))
beer_sales <- beer_sales %>%
mutate(transaction_date = as.Date(transaction_timestamp),
period = case_when(
transaction_date >= as.Date("2017-03-10") & transaction_date < as.Date("2017-03-17") ~ "Before",
transaction_date == as.Date("2017-03-17") ~ "During",
transaction_date > as.Date("2017-03-17") & transaction_date <= as.Date("2017-03-24") ~ "After",
TRUE ~ "Other"
)) %>%
filter(period %in% c("Before", "During", "After"))
beer_trend <- beer_sales %>%
group_by(transaction_date, period) %>%
summarise(total_sales = sum(sales_value), .groups = "drop")
ggplot(beer_trend, aes(x = transaction_date, y = total_sales, group = 1)) +
geom_line(color = "black", size = 1.2) +
geom_point(aes(color = period), size = 3) +
scale_color_manual(values = c("Before" = "blue", "During" = "forestgreen", "After" = "red")) +
labs(title = "Beer Sales Trends Around St. Patrick’s Day 2017",
x = "Date",
y = "Total Sales ($)",
color = "Period") +
theme_minimal()
This code first combines transaction and product data to focus on beer-related sales. It filters the data to include only beer transactions, then classifies them into three periods: before, during, and after St. Patrick’s Day 2017. It calculates the total sales for each period and date, and then plots the sales trend over time, with different colors for each period. The result is a line chart that visually represents how beer sales changed around St. Patrick’s Day.
beer_sales <- data %>%
filter(str_detect(tolower(department), "beer") | str_detect(tolower(product_category), "beer")) %>%
mutate(transaction_date = as.Date(transaction_timestamp))
holidays <- tibble(
holiday = c("New Year's Day", "Super Bowl", "St. Patrick's Day", "Memorial Day",
"Independence Day", "Labor Day", "Thanksgiving", "Christmas"),
date = as.Date(c("2017-01-01", "2017-02-05", "2017-03-17", "2017-05-29",
"2017-07-04", "2017-09-04", "2017-11-23", "2017-12-25"))
)
beer_sales_summary <- beer_sales %>%
group_by(transaction_date) %>%
summarise(total_sales = sum(sales_value), .groups = "drop")
holiday_sales <- beer_sales_summary %>%
inner_join(holidays, by = c("transaction_date" = "date"))
ggplot(holiday_sales, aes(x = reorder(holiday, -total_sales), y = total_sales, fill = holiday)) +
geom_bar(stat = "identity", show.legend = FALSE) +
labs(title = "Beer Sales on Major Holidays in 2017",
x = "Holiday",
y = "Total Sales ($)") +
theme_bw() +
coord_flip()
This code filters beer-related sales from a larger dataset, then summarizes the total beer sales by date. It then creates a list of major holidays in 2017 and joins this holiday data with the beer sales data, keeping only the sales that occurred on those holidays.
beer_sales <- transactions %>%
inner_join(products, by = "product_id") %>%
filter(product_category == "BEERS/ALES") %>%
mutate(week_flag = case_when(
week >= 10 & week <= 11 ~ "St. Patrick's Week",
week == 9 ~ "Previous Week",
week == 12 ~ "Next Week",
))
complementary_items <- transactions %>%
inner_join(products, by = "product_id") %>%
filter(basket_id %in% beer_sales$basket_id) %>%
group_by(basket_id, product_category) %>%
summarise(count = n(), .groups = "drop")
The beer_sales dataframe is created by joining the transactions and products datasets. Then, it filters only “BEERS/ALES” products and creates a new column week_flag that classifies the week as “St. Patrick’s Week”, “Previous Week”, or “Next Week.” The complementary_items dataframe identifies other items purchased alongside beer by filtering transactions where the basket_id matches that of beer_sales and then counting the occurrences of each product category.
complementary_items_summary <- complementary_items %>%
inner_join(beer_sales %>% select(basket_id, week_flag), by = "basket_id") %>%
group_by(week_flag) %>%
summarise(total_complementary_items = sum(count), .groups = "drop")
This section combines the complementary items with beer_sales by basket_id to include the week_flag for each basket. Then, it sums up the count of complementary items for each week_flag. Visualization of Complementary Items
complementary_items_summary <- complementary_items_summary %>%
filter(!is.na(week_flag))
ggplot(complementary_items_summary, aes(x = week_flag, y = total_complementary_items)) +
geom_bar(stat = "identity", fill = "DarkGreen") +
labs(title = "Complimentary Items Bought with Beer",
x = "", y = "Total Complimentary Items") +
scale_x_discrete(labels = c("Previous Week", "Next Week", "St. Patrick's Week")) +
theme_minimal()
A bar plot is created to show the total number of complementary items bought with beer, grouped by the week_flag. The x-axis represents the week, and the y-axis shows the total number of complementary items. Identifying Top Complementary Items After St. Patrick’s Week
after_st_patricks <- complementary_items %>%
inner_join(beer_sales %>% filter(week_flag == "Next Week") %>% select(basket_id), by = "basket_id") %>%
group_by(product_category) %>%
summarise(total_count = sum(count), .groups = "drop") %>%
arrange(desc(total_count))
This section filters the complementary_items for the week after St. Patrick’s Week (week_flag == “Next Week”) and summarizes the total count of each product category purchased during that week. Visualization of Complementary Items Bought After St. Patrick’s Week
product_categories <- c("SOFT DRINKS", "BAG SNACKS", "FLUID MILK PRODUCTS", "CHEESE", "BAKED BREAD/BUNS/ROLLS")
total_counts <- c(75, 65, 64, 61, 58)
data <- data.frame(product_categories, total_counts)
ggplot(data, aes(x = product_categories, y = total_counts)) +
geom_bar(stat = "identity", fill = "lightgreen") +
labs(title = "Complementary Items Bought with Beer (Week After St. Patrick's)",
x = "Product Category", y = "Total Count") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
This bar plot visualizes the top complementary items purchased with beer during the week after St. Patrick’s, based on the total count of each product category.
In conclusion, this analysis provides insights into complementary products bought alongside beer during key weeks (St. Patrick’s Week and the week after). By understanding which products are frequently purchased with beer, you can target specific items for promotions and marketing during these weeks.
Here we’ll be looking at the beer sales for different age groups and income ranges during St. Patrick’s Day week, and how it compares to the annual sales for those demographics. That way we have an idea of what demographics we should focus on selling towards more this cmoing year.
beer_products <- products %>%
filter(product_category == "BEERS/ALES")
beer_sales <- transactions %>%
inner_join(beer_products, by = "product_id")
combined_data <- transactions %>%
left_join(products, by = "product_id")
beers_ales_data <- combined_data %>%
filter(product_category == "BEERS/ALES")
combined_with_demographics <- combined_data %>%
left_join(demographics, by = "household_id")
beer_sales_demo <- transactions %>%
left_join(products, by = "product_id") %>%
left_join(demographics, by = "household_id") %>%
filter(str_detect(tolower(department), "beer") | str_detect(tolower(product_category), "beer")) %>%
mutate(transaction_date = as.Date(transaction_timestamp)) %>%
filter(transaction_date >= as.Date("2017-03-10") & transaction_date <= as.Date("2017-03-17"))
beer_sales_by_age <- beer_sales_demo %>%
group_by(age) %>%
summarise(total_sales = sum(sales_value, na.rm = TRUE), avg_spend = mean(sales_value, na.rm = TRUE), .groups = "drop")
ggplot(beer_sales_by_age, aes(x = age, y = total_sales, fill = age)) +
geom_bar(stat = "identity", show.legend = FALSE) +
scale_y_continuous(limits = c(0, 400)) +
labs(title = "Beer Sales by Age Group During St. Patrick’s Day Week (2017)",
x = "Customer Age Group",
y = "Total Sales ($)") +
theme_minimal()
Here we have the beer sales for each individual age group for the week of St. Patrick’s Day, which shows that shoppers between the ages of 25 to 54 are the largest consumer groups, with the most sales coming from ages 35-44.
beer_sales_by_income <- beer_sales_demo %>%
group_by(income) %>%
summarise(total_sales = sum(sales_value, na.rm = TRUE),
avg_spend = mean(sales_value, na.rm = TRUE), .groups = "drop")
ggplot(beer_sales_by_income, aes(x = income, y = total_sales, fill = income)) +
geom_bar(stat = "identity", show.legend = FALSE) +
scale_y_continuous(limits = c(0, 300)) +
labs(title = "Beer Sales by Income Group During St. Patrick’s Day Week (2017)",
x = "Income Group",
y = "Total Sales ($)") +
theme_minimal()
This graph shows the beer sales for age groups covering the entire year of 2017. As you can see, 45-54 year old shoppers’ beer sales are significantly higher compared to other age groups annually.
filtered_data <- combined_with_demographics %>%
filter(product_category == "BEERS/ALES")
ggplot(filtered_data, aes(x = age, y = sales_value, fill = age)) +
geom_bar(stat = "summary", fun = "sum") +
scale_y_continuous(limits = c(0, 20000)) +
labs(title = "Total Sales by Age Group for BEERS/ALES",
x = "Age Group",
y = "Total Sales Value") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
This next graph shows the beer sales for each income group during the week of St. Patrick’s Day. As shown, income groups between $35K - $99K are by far the most frequent income ranges to purchase beer around the holiday, with $25K - $34K and $150K - $174K income groups also appearing strong on the graph.
filtered_data_beers_ales <- combined_with_demographics %>%
filter(product_category == "BEERS/ALES")
ggplot(filtered_data_beers_ales, aes(x = income, y = sales_value, fill = income)) +
geom_bar(stat = "summary", fun = "sum") +
scale_y_continuous(limits = c(0, 15000)) +
labs(title = "Total Sales for BEERS/ALES by Income Group",
x = "Income Group",
y = "Total Sales Value") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
This last table shows the beer sales by income for all of 2017. The data on this graph shows the most beer being purchased by those in the $25K - $99K income ranges, with little activity in other income groups.
This analysis examines beer sales trends around St. Patrick’s Day compared to other holidays and typical weeks. The goal is to identify high-spending demographics, key sales patterns, and complementary product purchases to help Regork optimize pricing, promotions, and stocking strategies.
Using the Complete Journey dataset (2017), we analyzed transactions, demographics, and product details. We examined beer sales before, during, and after St. Patrick’s Day, compared them to other major holidays, and identified the most frequent customer segments and complementary purchases. Data was processed and visualized using R.
Beer sales spike sharply on St. Patrick’s Day, ranking among the top beer-selling holidays. The 30-44 age group and $50K-$75K income households drive the most sales. Common complementary purchases include snacks, soft drinks, and dairy products, with sustained demand even after the holiday.
Regork should target mid-income consumers (30-44 age group) with holiday promotions, offer beer + snack bundles, stock inventory early, and use dynamic pricing to maximize sales before and after St. Patrick’s Day. These strategies will help sustain revenue beyond the holiday peak.
This analysis is based on 2017 data and may not reflect current trends. Future improvements could include predictive modeling, regional sales analysis, and real-time pricing adjustments to enhance decision-making.