Purpose
The purpose of these queries is to streamline the integration and transformation of marketing and campaign data from multiple sources into a unified format. These Power Query scripts address various types of campaign-related data—ranging from email campaigns, social media posts, and advertising, to events, page performance, and form submissions.
Process
Source Selection:
- The query starts by loading data from the
hbs EmailCampaigns
table. - myBMT (bmt-dwh-uks-app-my.azurewebsites.net)
Adding a Custom Column:
- A new column named
Custom1
is added to the table, with a value of0
for all rows.
Unpivoting Data:
- The query unpivots all columns except for
CampaignGuid
,CampaignId
,FromEmail
,Id
,Name
,SentBy
,Subject
,SentByEmail
,From
,EmailType
, andSendDate
. - This results in two new columns:
Attribute
(original column names) andValue
(corresponding values).
Changing Data Types:
- The
SendDate
column is first converted into thedatetime
data type and then changed into thedate
data type for easier date-based analysis.
Renaming Columns:
- The
SendDate
column is renamed toDate_Key
for consistency with other queries.
Removing Unnecessary Columns:
- The following columns are removed as they are not needed for this specific analysis:
FromEmail
,From
,SentBy
,SentByEmail
,Subject
, andEmailType
.
Adding a Platform Column:
- A new column named
Platform
is added to indicate that the data comes from “Email Campaigns” for all rows.
Adding a Source Type Column:
- A column named
SourcesType
is added to specify the source as “Email” for each row.
Result Output:
- The final table is output after all transformations and new columns are applied.