Skip to contents

Introduction

Before we dive into the nitty gritty, it’s important to know the context of the project. This Appraisal was carried out for Orthofeet, an orthopedic shoe manufacturer and retailer.

Orthofeet’s orthotic shoes are biomechanically engineered with unique comfort features to offer the very best solution for sensitive feet and other physical ailments affected by foot problems or poor posture.

Orthofeet hired Gradient to do two things:

  • Build out defensible, model-based financial projections for the purposes of marketing Orthofeet to potential buyers
  • Build out a sufficiently robust quantitative and qualitative understanding of the customer to give Orthofeet the confidence to expand into new customer segments and products with confidence

Although the objectives listed above serve two different purposes and sets of stakeholders, there is a common thread between them, which is a customer lifetime value (LTV) model that can be applied to both. For more detail on the approach and the accepted Scope of Work (SOW), please refer to the proposal.

Preparation

As for any Appraise project, the complexity lies in getting the correct data, and aligning on the outputs we’re going to produce for our client. In this project, both of these things went particularly smooth, which is why we’re writing up a case study about it.

Getting the right data

The first step is to make sure that the client has the data guidelines to refer to when try to compile the necessary data sets. After they sent over their first batch of data, you’ll need to align on how to process it correctly to get to the ELOG format that we require. This typically warrants a call or at least some back and forth on how to summarize transactions, and what rows of data to delete (e.g., empty sales or shipping line items).

A few checks that will help make sure you’re processing the data correctly is to create a few summaries of the data they send over. This will typically highlight discrepancies in what they were expecting. The following set of summaries will be helpful:

  1. A summary of the total sales, returns, customers and transactions by year
  2. A summary of the total sales, newly acquired customers and transactions by cohort* year
  3. A table summary of the customer metadata columns they care about

Additionally it’ll be useful to align how to account for returns in the data.

**a cohort refers to the acquisition period, e.g., when they made their first purchase*

Aligning on the outputs

A painless transition from executing the analysis to creating the synthesis depends a lot on aligning with the client on what they’ll receive. In this particular project, we created a Ghost Deck filled with made up data and charts, but reflecting how we’d actually deliver the results. We took the client through the ghost deck on a live call and made a few changes based on their feedback. After that, we locked it in and got started. The actual synthesis deck aligns for 95% with the ghost deck, which was fantastic.

Reading the data

Typically you’ll get the data as multiple raw CSV files. This project was no different. After initializing the project and setting up an S3 bucket, you can upload the CSV files and process them straight from R using the cloud_s3_read_bulk() function.

Order data


spine_order_data <- 
  g6tr::cloud_s3_ls(path = 'data') %>%
  filter(grepl('Orders', name)) %>%
  cloud_s3_read_bulk(quiet = TRUE) %>%
  bind_rows() %>%
  mutate(date = as.Date(day, "%m/%d/%Y")) %>%
  rename(cust = customer_email)

Metadata

spine_product_metadata_missing <- 
  cloud_s3_read("data/SKUs Missing Category.xlsx") %>%
  .[[1]] %>%
  clean_names() %>%
  select(-style)

spine_product_metadata_1 <-
  cloud_s3_read("data/Gian - Product SKUs.csv") %>%
  clean_names() %>%
  rename(variant_sku = product_sku) %>%
  mutate(style = as.character(style)) %>%
  filter(category != "0") %>%
  select(-style)

spine_product_metadata_2 <- 
  cloud_s3_read("data/GianKarlo Casimiro - Product SKUs v2.csv") %>%
  clean_names() %>%
  filter(category != "0") %>%
  select(-style)

spine_product_metadata <- 
  spine_product_metadata_2 %>%
  #bind_rows(spine_product_metadata_2) %>%
  bind_rows(spine_product_metadata_missing) %>%
  distinct() %>%
  arrange(variant_sku, desc(gender)) %>%
  group_by(variant_sku) %>%
  slice(1) %>%
  ungroup()
  
spine_acquisition_metadata <-
  cloud_s3_read("data/Gian - Acquisition Channel Legend.csv") %>%
  clean_names()
  

Preparing the data

This next step is super important—it’s where we create the elog. As a reminder, the elog data should follow the same patterns as the below;

g6tr.appraise::elog %>% head()
g6tr.appraise::returns %>% head()
g6tr.appraise::cust_acquisition %>% head()

Elog

In the code below you can see that we filtered out a few specific rows based on client input, as well as all transactions where there were either no items or no sales. We then summed this up to the transaction level (not the customer level yet). The original format this order data came in is called an order-items table, which has multiple items (and return) rows which should be summed up to get to the full transaction.

elog_raw <-
  spine_order_data %>%
  filter(api_client_title != "DataFeedWatch") %>% # Remove amazon sales
  filter(cust != "x3amazonorders@orthofeet.com") %>% # Remove amazon sales
  group_by(order_name) %>%
  summarize(cust = first(cust),
            date = first(date),
            items = sum(ordered_item_quantity, returned_item_quantity),
            sales = sum(net_sales)) %>%
  select(cust, date, items, sales) %>%
  filter(items > 0) %>% # Remove transactions with zero items
  filter(sales > 0) %>% # Remove transactions with zero sales
  validate_elog()

elog <- elog_raw$elog

cloud_s3_write(elog, file = "data/2022-06-13_elog.csv")

Items and Returns

Then we summarized the number of items each customer had purchased, but we did not include any data on returns. The reason being that we accounted for the returns by modeling the true net sales, not the gross sales.

spine_items <- 
  elog %>%
  group_by(cust) %>%
  summarize(items = sum(items))

cloud_s3_write(spine_items, file = "data/2022-06-13_items.csv")

Additional customer metadata

For the customer metadata, we had to dig a little deeper into the transaction history. Sometimes the client can provide a summarized metadata view, but here we needed to create it ourselves. We tagged customers based on their first purchase with the following: - Gender - the gender category of the item purchased - ZIP code - shipping or billing postal code of the first purchase - Category - product category of the first item purchased - Acquisition Channel - campaign or channel the customer purchased through the first time

First Purchase info
first_purchases <- 
  spine_order_data %>%
  filter(sale_kind == 'order') %>%
  arrange(cust, date) %>%
  group_by(cust) %>%
  top_n(1, wt = date) %>%
  filter(total_sales > 0)

first_purchase_sku <-
  first_purchases %>%
  ungroup() %>%
  select(cust, variant_sku) %>%
  left_join(spine_product_metadata, by = c("variant_sku"))


# first_purchase_sku %>%
#   filter(is.na(category) | category == "0") %>%
#   distinct(variant_sku, .keep_all = TRUE) %>%
#   select(-cust) %>%
#   cloud_drive_write(file = 'data/missing_sku_metadata.xlsx',local = TRUE)
ZIP

spine_customer_zip <- 
  first_purchases %>%
  ungroup() %>%
  select(cust, billing_postal_code, shipping_postal_code) %>%
  mutate(zip = ifelse(is.na(shipping_postal_code), billing_postal_code, shipping_postal_code)) %>%
  distinct(cust, .keep_all = TRUE) %>%
  separate(zip, c("zip", "extra"), sep = '-') %>%
  select(cust, zip)

cloud_s3_write(spine_customer_zip, "data/2022-06-13_spine_customer_zip.csv")
Gender
cust_gender <- 
  first_purchase_sku%>%
  group_by(cust) %>%
  count(gender) %>%
  ungroup() %>%
  pivot_wider(names_from = gender, values_from = n, values_fill = 0) %>%
  mutate(gender = case_when(
    W == M & W > 0 ~ "Women",
    W > M ~ "Women",
    M > W ~ "Men",
    U > M ~ "Women",
    TRUE ~ NA_character_
  )) %>%
  select(cust, gender)

cust_gender$gender %>% table(useNA = 'always')
Category

cust_product_category <- 
  first_purchase_sku %>%
  group_by(cust) %>%
  count(category) %>%
  slice(1) %>%
  ungroup() %>%
  select(cust, category)
Acquisition Channel

cust_acquisition_channel <- 
  first_purchases %>%
  ungroup() %>%
  select(cust, referrer_source, utm_campaign_source, utm_campaign_name) %>%
  left_join(spine_acquisition_metadata,
            by = c("referrer_source", "utm_campaign_source", "utm_campaign_name")) %>%
  group_by(cust) %>%
  count(channel) %>%
  slice(1) %>%
  ungroup() %>%
  select(cust, channel)
  
Time since first repeat purchase

repeat_purchase <- 
  elog %>%
  left_join(spine_customer_metadata) %>%
  elog_add_first_date() %>%
  arrange(cust, date) %>%
  group_by(cust) %>%
  mutate(second_date = lead(date)) %>%
  slice(1) %>%
  ungroup() %>%
  filter(date == first_date) %>%
  mutate(days_since_first_purchase = as.numeric(difftime(second_date, first_date, units = 'days')))


cloud_s3_write(repeat_purchase, file = "data/2022-06-13_cust_repeat_purchase.csv")
Combined

spine_customer_metadata <-
  elog %>%
  select(cust) %>%
  unique() %>%
  left_join(cust_gender, by = "cust") %>%
  left_join(cust_product_category, by = "cust") %>%
  left_join(cust_acquisition_channel, by = "cust")

cloud_s3_write(spine_customer_metadata, "data/2022-06-13_spine_customer_metadata.csv")

Customer model

Now that we have all the necessary data we can start building our customer lifetime value model.

The configuration for the model is going to be as follows.

  • We set the CPA scenario’s as default, ranging from 25 to 60
  • Contribution Margins range from .3 to .55, with .47 being the number Orthofeet provided to us
  • We’re going to be calculating this on a 5 year unified_horizon, considering that we have almost ~ 5 years worth of data
  • The number of weeks to forecast is related to the forecast scenario’s they want to run, which range from 2022-06 to 2025-12

spine_scenarios <- 
  cloud_s3_read('data/22-06-10_forecast_scenarios.xlsx') %>%
  .[[1]] %>%
  janitor::clean_names() %>%
  select(-x9) %>%
  filter(!is.na(period_start)) 

pred_periods <- 
  spine_scenarios %>%
  filter(period_start  > ymd(as.Date("2022-05-01"))) %>%
    mutate(pred_period = lubridate::time_length(difftime(period_end, period_start), "years"),
         pred_period = cumsum(pred_period))
  

config <- 
  configure_appraise(sample = F,
                     cpa = c(25, 30, 35, 40, 45, 50, 55, 60),
                     cm =  c(.3, .4, .47, .55),
                     currency = '$',
                     unified_horizon = 5,
                     pred_periods = pred_periods$pred_period, # 1 month periods for 65 weeks
                     n_forecast = length(pred_periods$pred_period))

At this point, we ran into two issues:

  1. The dataset we used as input for the model was too large. STAN could estimate it, but the draws object would exceed the available RAM all the time.
  2. The STAN parameter dropout_at_zero was set to 1, which caused the model to fail. We had to manually set this to 0.

With these issues in mind, we divided the entire customer base up into 15 random samples. We ran the full model with dropout_at_zero set to 0 and saved the objects. We then removed all the objects from memory before modeling the next sample. This entire process took a full night, so make sure you have enough time to run this.

set.seed(123)

n_samples <- 15

cust_sample <- 
  elog %>%
  select(cust) %>%
  distinct() %>%
  mutate(sample = sample(1:n_samples, nrow(.), replace = TRUE))

cust_sample %>%
  count(sample) %>%
  mutate(percent = n/sum(n))

elog_samples <-
  elog %>%
  left_join(cust_sample)

item_samples <- 
  spine_items %>%
  left_join(cust_sample)

for(i in 1:n_samples){
  elog_tmp <- elog_samples %>%
    filter(sample == i) %>%
    select(-sample)
  
  items_tmp <- item_samples %>%
    filter(sample == i) %>%
    select(-sample) 
  
  cbs_tmp <- elog_to_stan(elog_tmp,
                          config = config,
                          items_and_returns = items_tmp)
  
  cbs_tmp$stan$dropout_at_zero <- 0
  
  pred_tmp <- fit_customer_model(cbs = cbs_tmp,
                                 config = config)
  
  cloud_s3_write(pred_tmp,
                 paste0('models/2022-06-13/2022-06-13_spine_customer_predictions_sample_', i, '.rds'))
  
  cloud_s3_write(pred_tmp$customer_level_data,
                 paste0('models/2022-06-13/2022-06-13_spine_customer_level_output_', i, '.rds'))
  
  cloud_s3_write(pred_tmp$forecasts,
                 paste0('models/2022-06-13/2022-06-13_spine_forecasts_', i, '.rds'))

  rm(list = c("elog_tmp", "items_tmp", "cbs_tmp", "pred_tmp"))
  
}

Holdout test

Now that we have our modeled predictions, it’s good to run a holdout test to see how well our model performs. This is pretty much the same as an 80/20 train/test in typical machine learning to measure performance.

The holdout is run on a sample, with the holdout date set to about a year prior to the last transaction. This will allow us to compare the actual sales and transactions with our forecasted sales and transactions.

(max(elog$date) - as.Date("2021-04-30")) / 31

as.numeric(max(elog$date) - min(elog$date)) / 365 # ~ 6.5 years

holdout_config <- 
  configure_appraise(sample = T, 
                     sample_size = 10000,
                     holdout_date = as.Date("2021-04-30"), # 12 months
                     cpa = c(25, 30, 35, 40, 45, 50, 55, 60),
                     cm =  c(.3, .4, .47, .55),
                     currency = '$',
                     unified_horizon = 5,
                     pred_periods = 1, 
                     n_forecast =  1)

set.seed(20220503)

spine_cbs_holdout <-
  elog_to_stan(elog,
               config = holdout_config,
               items_and_returns = spine_items)


holdout_predictions <- fit_customer_model(cbs = spine_cbs_holdout, config = holdout_config)

# Quick check
holdout_predictions$customer_level_data$expected_tx_pred_period_1 %>% sum
spine_cbs_holdout$cbs$x.star %>% sum

holdout_predictions$customer_level_data$expected_clv_pred_period_1 %>% sum
spine_cbs_holdout$cbs$sales.star %>% sum

cloud_s3_write(holdout_predictions, 'models/2022-04-25-holdout_predictions.rds')

The holdout test resulted in only a 6.3% deficit between the predicted and actual sales numbers, suggesting a reliable forecast model. - Our model slightly underestimated the actual sales, which means that all the estimated figures are on the conservative side - The 6.3% difference falls in directly between the range of 2.5-7.5% we typically see for our model performances

Forecast model

We received the CPA and Spend scenarios from Orthofeet and Solomon Partners (the bank we’re working with). We ran four different scenarios; - Base CPA and Spend - Increased CPA and base spend (more conservative) - Base CPA and increased spend (less conservative) - Increased CPA and increased spend

We put this through our forecast model, but there was one very important aspect to this. Considering that we built 15 models on samples, we need to make sure that we either combine all the forecasted sales, or we multiple the sales of one model by 15. The latter is what we did to control for the smaller sample.


#spine_customer_predictions <- cloud_s3_read('models/2022-06-13_spine_customer_predictions_sample.rds')
spine_customer_predictions <- cloud_s3_read('models/2022-06-13/2022-06-13_spine_customer_predictions_sample_1.rds')

spine_scenarios_final <-
  spine_scenarios %>%
  filter(period_start  > ymd(as.Date("2022-05-01"))) %>%
  mutate(pred_period = lubridate::time_length(difftime(period_end, period_start), "years"),
         pred_period = cumsum(pred_period)) %>%
    mutate(cpa_scenario_1 = cpa,
         spend_scenario_1 = spend,
         cpa_scenario_2 = cpa * (1+assumption_cpa_increase),
         spend_scenario_2 = spend,
         cpa_scenario_3 = cpa,
         spend_scenario_3 = spend * (1 + assumption_spend_increase_yo_y),
         cpa_scenario_4 = cpa_scenario_2,
         spend_scenario_4 = spend_scenario_3)

spine_forecasts <- spine_customer_predictions$forecasts

# Adjust because we ran this only for 1/15th sample of all customers
spine_forecasts$forecasted_tx  <- spine_forecasts$forecasted_tx * 15
spine_forecasts$forecasted_spend  <- spine_forecasts$forecasted_spend * 15


spine_scenario_predictions <-
  fit_forecast_model(forecasts = spine_forecasts,
                     n_scenarios = 4,
                     cpa_scenarios =  spine_scenarios_final %>% select(contains('cpa_scenario')) %>% as.matrix(),
                     spend_scenarios = spine_scenarios_final %>% select(contains('spend_scenario')) %>% as.matrix(),
                     config = config)

spine_scenario_predictions$forecasts <-
  spine_scenarios_final %>%
  select(fiscal_year:new_customers) %>%
  rename(year = fiscal_year, month = period_month) %>%
  bind_cols(spine_scenario_predictions$forecasts)


spine_scenario_predictions$forecasts %>%
  select(year, month, sales_scenario_1, tx_scenario_1)

cloud_s3_write(spine_scenario_predictions, 'models/2022-06-13_spine_scenario_predictions_test_dropout.rds')

Synthesis

Now that we have all of our modeled data it’s time to produce the assets. This includes plots and tables for in our deck, as well as excel exports of all the data behind the charts. I’m not going to show every single plot and table we make here, because it’s quite long. If you want to see all of it, you can visit the code

Plots

In the simplest form, this is how we create the base plots:

plots <- list()

plots[["clv"]] <- 
 customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 main_color = MAIN_COLOR,
                                 type = 'clv') +
  theme_appraise_default() 

cloud_drive_write_plot(x = plots[["clv"]], name = 'clv')

plots[["total_tx"]] <- 
 customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 main_color = MAIN_COLOR,
                                 type = 'total_tx') +
  scale_x_date("Customer acquisition date", date_breaks = date_breaks, date_labels = "%Y")+
  theme_appraise_default()


cloud_drive_write_plot(x = plots[["total_tx"]], name = 'total_tx')


plots[["e_aov"]] <- 
 customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 main_color = MAIN_COLOR,
                                 type = 'e_aov') +
  theme_appraise_default() 


cloud_drive_write_plot(x = plots[["e_aov"]], name = 'e_aov')


plots[["p_alive"]] <- 
 customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 main_color = MAIN_COLOR,
                                 type = 'p_alive') +
  theme_appraise_default()

plots[["p_churn"]] <- 
 customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 main_color = MAIN_COLOR,
                                 type = 'p_churn') +
  theme_appraise_default()



cloud_drive_write_plot(x = plots[["p_churn"]], name = 'p_churn')

For plots that are grouped by a specific variable such as category, we simply add a new argument:


categories <- category_data$category %>% unique %>% sort()
category_colors <- appraise_pal()(9)

names(category_colors) <- categories

plots[["category_clv"]] <- 
  customer_level_output(cust_data = category_data_filtered_outliers,
                        config = config,
                        main_color = MAIN_COLOR,
                        type = 'clv',
                        group = category,
                        size = 8,
                        hjust = 0.4,
                        linewidth = 2)  %>%
  category_theme(.) +
  scale_color_manual(values = category_colors, guide = F) + 
  scale_fill_manual(values = category_colors, guide = F)

cloud_drive_write_plot(x = plots[["category_clv"]], name = 'category_clv_filtered',
                       height = 900, width = 1200)

  

plots[["category_total_tx"]] <- 
 customer_level_output(cust_data = category_data_filtered_outliers,
                       config = config,
                       type = 'total_tx',
                       group = category, 
                       size = 8,
                       hjust = 0.4,
                       linewidth = 2)  %>%
  category_theme() +
  scale_color_manual(values = category_colors, guide = F) + 
  scale_fill_manual(values = category_colors, guide = F)

cloud_drive_write_plot(x = plots[["category_total_tx"]], name = 'category_total_tx_filtered',
                       height = 900, width = 1200)

  

Tables

The main tables we’ll use to fill the presentation are the cohort summaries and holdout predictions. These can be created with the following code

Cohort summaries

tables <- list()
tables[["cohort_summary"]] <-
  customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 type = 'cohort_summary',
                                 output = 'data') %>%
  cohort_sum_table()


tables[["gender_cohort_summary_men"]] <-
  customer_level_output(cust_data = spine_customer_level_data %>% filter(gender == 'Men'),
                        config = config,
                        type = 'cohort_summary',
                        output = 'data') %>%
  cohort_sum_table()

tables[["gender_cohort_summary_women"]] <-
  customer_level_output(cust_data = spine_customer_level_data %>% filter(gender == 'Women'),
                        config = config,
                        type = 'cohort_summary',
                        output = 'data') %>%
  cohort_sum_table()

Holdout results

holdout_res  <- cloud_s3_read('models/2022-04-25-holdout_results.rds')
tables[["holdout_tx_pred"]] <- holdout_res$tx_predictions
tables[["holdout_sales_pred"]] <- holdout_res$sales_predictions

Datasets

The code below was used to produce all the excel files. Please note that you have to go into the excel sheet yourself and clean up the file;

  • Format the columns correctly ($, number, percentages)
  • Let the data fit the column

Existing Customers

existing_customer_datasets <- list()

existing_customer_datasets[["Customer Transaction Summary (Pre-Model)"]]  <- 
  elog_summary(elog)$summary_by_year %>% 
  pretty_table() %>%
  rename(`Average Order Value (AOV)` = AOV)

existing_customer_datasets[["Customer Waterfall"]]  <- 
  elog_waterfall(elog, 
                 date_window = 'year',
                 to_summarize = 'customers') %>%
  pretty_table()


existing_customer_datasets[["Customer Waterfall - Quarterly"]]  <- 
  elog_waterfall(elog, 
                 date_window = 'quarter',
                 to_summarize = 'customers') %>%
  pretty_table()


existing_customer_datasets[["Customer Waterfall - Monthly"]]  <- 
  elog_waterfall(elog, 
                 date_window = 'month',
                 to_summarize = 'customers') %>%
  pretty_table()


existing_customer_datasets[["Tx Waterfall"]]  <- 
  elog_waterfall(elog, date_window = 'year',
                 to_summarize = 'transactions') %>% 
  pretty_table()

existing_customer_datasets[["Tx Waterfall - Quarterly"]]  <- 
  elog_waterfall(elog, date_window = 'quarter',
                 to_summarize = 'transactions') %>% 
  pretty_table()

existing_customer_datasets[["Tx Waterfall - Monthly"]]  <- 
  elog_waterfall(elog, 
                 date_window = 'month',
                 to_summarize = 'transactions') %>%
  pretty_table()


existing_customer_datasets[["Sales Waterfall"]]  <- 
  elog_waterfall(elog, date_window = 'year',
                 to_summarize = 'sales') %>% 
  pretty_table()

existing_customer_datasets[["Sales Waterfall - Quarterly"]]  <- 
  elog_waterfall(elog, date_window = 'quarter',
                 to_summarize = 'sales') %>% 
  pretty_table()

existing_customer_datasets[["Sales Waterfall - Monthly"]]  <- 
  elog_waterfall(elog, date_window = 'month',
                 to_summarize = 'sales') %>% 
  pretty_table()


existing_customer_datasets %>%
  cloud_drive_write(file = 'data/2022-06-13_waterfalls.xlsx', fun = writexl::write_xlsx)

Cohort summaries

cohort_summaries <- list()

cohort_summaries[["Overall Cohort Summary"]] <- 
    customer_level_output(cust_data = spine_customer_level_data,
                                 config = config,
                                 type = 'cohort_summary',
                                 output = 'data') %>%
  cohort_sum_table(format = FALSE)

create_cohort_summary <- function(cust_dat, var, category){
  
  dat <- 
    cust_dat %>%
    dplyr::filter(get(var) == !!category)
  
  customer_level_output(cust_data = dat,
                        config = config,
                        type = 'cohort_summary',
                        output = 'data') %>%
  cohort_sum_table(format = F) %>%
    mutate(Category = category, .before = 1)
}

# Gender
genders <- c("Men", "Women")

cohort_summaries[["Gender Cohort Summaries"]] <- 
  map_df(genders, create_cohort_summary,
         cust_dat = gender_data, var = 'gender')

# Product Category
product_categories <- category_data$category %>% unique() %>% sort()

cohort_summaries[["Product Category Cohort Summaries"]] <- 
  map_df(product_categories, create_cohort_summary,
         cust_dat = category_data, var = 'category')
  
# Channel
channel_categories <- channel_data$channel %>% unique() %>% sort()

cohort_summaries[["Channel Cohort Summaries"]] <- 
  map_df(channel_categories, create_cohort_summary,
         cust_dat = channel_data, var = 'channel')
  


cloud_drive_write(cohort_summaries,
                  file = 'data/2022-05-11_cohort_summaries.xlsx', 
                  format_headers = TRUE)

Repeat purchase

repeat_purchase_data <- list()

repeat_purchase_data[["Repeat Purchase - Overall"]] <- elog_repeat_purchase_data

repeat_purchase_data[["Repeat Purchase - Men"]] <- elog_repeat_purchase_data_men

repeat_purchase_data[["Repeat Purchase - Women"]] <- elog_repeat_purchase_data_women


cloud_drive_write(repeat_purchase_data,
                  file = 'data/2022-05-23_repeat_purchase_summaries.xlsx', 
                  format_headers = TRUE)

Forecast summaries & waterfalls


forecast_tables <- list()

forecast_tables[["Forecasts"]] <-  spine_scenario_predictions$forecasts %>%
  select(-new_customers) %>%
  relocate_scenarios() %>%
  pretty_table()

forecast_tables[["Forecasts by Year"]] <- spine_scenario_predictions$forecasts %>%
  select(-month:-new_customers) %>%
  group_by(year) %>%
  summarize_all(sum) %>%
  relocate_scenarios() %>%
  pretty_table()


forecast_tables %>%
  cloud_drive_write(file = 'data/2022-06-13_forecast_summaries.xlsx', fun = writexl::write_xlsx)
  
set_month_names <- function(x){
  
  x %>%
    select(-period) %>%
    setNames(paste0(pred_periods$fiscal_year, " - ", pred_periods$period_month)) %>%
    mutate(Period = paste0(pred_periods$fiscal_year, " - ", pred_periods$period_month), .before = 1)
}

rename_tx <- function(x){
  names(x) <- gsub(pattern = "transaction", replacement = "tx", names(x))
  x
}

forecast_waterfall_tables <- spine_scenario_predictions$forecast_waterfalls %>% 
  unlist(recursive = FALSE) %>%
  map(set_month_names) %>%
  rename_tx()


forecast_waterfall_tables %>%
  cloud_drive_write(file = 'data/2022-06-13_forecast_waterfalls.xlsx', fun = writexl::write_xlsx)

Presentation

Considering that we built out the ghost deliverable, all we need to do was plug in the new charts and tables on the spots we originally designed for them.

When creating the slides, please refer to our best practices, which include:

BLUF: bottom line up front

  • Don’t bury the lede. In other words, begin with key information.
  • For example, key findings or takeaways should be in the first 2 to 3 slides

Headlines should describe the key finding

  • All slide headlines, when concatenated, should add up to an executive summary

Use colors to your advantage

  • Colors are a great way to effortlessly attract your audience’s eyes to key information

Use consistent color palettes, icons, and patterns of conveying information

  • When you use a color or icon to represent a group, continue to use that color throughout the deck
  • When you depict significance testing in a particular way, continue to repeat the pattern throughout the deck
  • Generally speaking, when you’ve established a pattern or heuristic for your audience, don’t deviate from it