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 EmailCampaignstable. - myBMT (bmt-dwh-uks-app-my.azurewebsites.net)
Adding a Custom Column:
- A new column named
Custom1is added to the table, with a value of0for 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
SendDatecolumn is first converted into thedatetimedata type and then changed into thedatedata type for easier date-based analysis.
Renaming Columns:
- The
SendDatecolumn is renamed toDate_Keyfor 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
Platformis added to indicate that the data comes from “Email Campaigns” for all rows.
Adding a Source Type Column:
- A column named
SourcesTypeis 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.