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_Leadership
table. - 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_live
becomesDate_Key
Piece_title
becomesName
Campaign:_CampaignId
becomesCampaign Id
Campaign.lookupValue
becomesCampaign Name
- Several columns are renamed to make their names more meaningful:
- Changing Column Types:
- The
Date_Key
column is changed to thedatetime
data 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
Platform
is 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 Name
column is duplicated to create a new column calledCampaign Name - Copy
.
- The
- Splitting the Campaign Name Column:
- The duplicated
Campaign Name
column 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 Id
becomesCampaignGuid
Campaign Name - Copy
becomesCampaign Name
Campaign Name.1
becomesSourcesType
ID
becomesObjectID
- Several columns are renamed:
- Removing Additional Unnecessary Columns:
- The query removes the columns
Campaign Name.2
,Campaign Name.3
, and the duplicatedCampaign Name
column 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”