Actually, data collection is already the “E” of ETL, collecting or extracting data from different sources. In this part, I’m gonna focus on “transformaiton” and “load” in MySQL.

Below is all the datasets that I’ve already collected in raw data collection phase. I summarize them here:
sales_raw_data (daily data)
cci_raw_data (monthly data)
sales_event_raw_data (daily data) comp_media_spend_raw_data (weekly data)
offline_raw_data (weekly data)
dma_hh_raw_data
fb_raw_data (weekly data)
display_raw_data (weekly data)
wechat_raw_data (weekly data)
paidsearch_raw_data (weekly data)
activity_and_spend_from_2014_to_2017 (weekly data)
original_spend_for_2018 (weekly data)
original_activity_for_2018 (weekly data)

Load

Load all the prepared data into MySQL for later transformation.

Transformation

1. Check data integrity problem

Following are some data integrity problems:

Different spelling of the same name like Jon and John, Google and Google Inc etc.

Invalid product collected at POS as manual entry can lead to mistakes.

2. Validations are done during this stage

Filtering – Selected only certain columns to load.

Data threshold validation check.

Required fields should not be left blank.

Cleaning (for exmaple, mapping NULL to 0).

Split a column into multiples and merging multiple columns into a single column.

Transposed rows and columns.

Used lookups to merge data.

Transformed all the data into weekly data (starting from Monday). Becasue we used weekly data to do sales analysis. In this part, I used date_meta_data to do the transformation. the metadata is a standard date data starting from Monday between 2014 and 2017. This is the snapshot:
date_meta_data_snapshot

Summary

Through ETL process, I managed to transform all the data collected into unit format that I want and merge them into a integrated dataset named mmm_raw. Below is the snapshot:
mmm_raw_snapshot

af_raw_data brief
· 208 rows, 22 columns
· column names: Period, Month, CCI, National TV GRPs, Magazine GRPs, Paid Search, Display, Facebook Impressions, Wechat, Sales Event, Comp Media Spend, Sales, DisplayAlwaysOnImpression, DisplayBrandingImpression, DisplayWebsiteImpression, DisplayHolidayImpression, SearchBrandingclicks, SearchAlwasyOnclicks, SearchWebsiteclicks, FacebookBrandingImpressions, FacebookHolidayImpressions, FacebookOtherImpressions.

After ETL & data aggregation, I’m gonna dive into exploration analysis in R. (see next post)