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 Thought_Leadershiptable. - myBMT (bmt-dwh-uks-app-my.azurewebsites.net)
- The query starts by loading data from the
- Removing Unnecessary Columns:
- The query removes a set of columns that are not needed for the analysis. These columns include
Campaign.isSecretFieldValue,Color_Tag,Compliance_Asset_Id,Publication:_ID,Content_Type,Modified,Created,Date_end, andCampaign.lookupId.
- The query removes a set of columns that are not needed for the analysis. These columns include
- Renaming Columns:
- Several columns are renamed to make their names more meaningful:
Date_livebecomesDate_KeyPiece_titlebecomesNameCampaign:_CampaignIdbecomesCampaign IdCampaign.lookupValuebecomesCampaign Name
- Several columns are renamed to make their names more meaningful:
- Changing Column Types:
- The
Date_Keycolumn is changed to thedatetimedata type, ensuring correct formatting for date values.
- The
- Unpivoting Data:
- The table is unpivoted by transforming all columns except
Name,ID,Campaign Name,Campaign Id, andDate_Key. This means all other columns are turned into two columns:Attribute(which contains the original column names) andValue(which contains the corresponding data).
- The table is unpivoted by transforming all columns except
- Adding a Platform Column:
- A new column called
Platformis added to every row, and its value is set to"Thought Leadership"to classify the data.
- A new column called
- Duplicating the Campaign Name Column:
- The
Campaign Namecolumn is duplicated to create a new column calledCampaign Name - Copy.
- The
- Splitting the Campaign Name Column:
- The duplicated
Campaign Namecolumn is split into three separate columns using the delimiter"| ". This results in three new columns:Campaign Name.1,Campaign Name.2, andCampaign Name.3.
- The duplicated
- Renaming Columns:
- Several columns are renamed:
Campaign IdbecomesCampaignGuidCampaign Name - CopybecomesCampaign NameCampaign Name.1becomesSourcesTypeIDbecomesObjectID
- Several columns are renamed:
- Removing Additional Unnecessary Columns:
- The query removes the columns
Campaign Name.2,Campaign Name.3, and the duplicatedCampaign Namecolumn as they are no longer needed.
- Result Output:
- The transformed data, with the unnecessary columns removed, is returned as the final output of the query.
1 thought on “Marketing.ThoughtLeadership”