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 Events
table. - myBMT (bmt-dwh-uks-app-my.azurewebsites.net)
- The query starts by loading data from the
- Adding Date Column:
- A new column,
Date_Key
, is added, which takes the value from theStart_date
field. This makes it easier to analyze data by event start dates.
- A new column,
- Removing Unnecessary Columns:
- Several irrelevant or sensitive columns are removed, such as fields related to campaign secrecy, user details (e.g., emails, job titles), and metadata (e.g., modified date, created date, labels). This step ensures that only the essential information is retained for analysis.
- Changing Data Type:
- The
Date_Key
column is transformed to thedate
data type for consistency and easy date-based analysis.
- The
- Unpivoting Columns:
- All columns except the
ID
,Date_Key
,Event.lookupValue
,Campaign.lookupValue
, andCampaign:_CampaignId
columns are unpivoted. This step converts the table into a long format, where each attribute is represented in a single column calledAttribute
, and its corresponding value is placed in theValue
column.
- All columns except the
- Adding Platform Information:
- A new column
Platform
is added to label all the rows with the value “Events”, which helps to distinguish this data from other platforms when appending with other datasets.
- A new column
- Adding Source Information:
- Another column
SourcesType
is added with the value “Events”, marking this data source as event-related.
- Another column
- Splitting Campaign Name by Delimiter:
- The
Campaign.lookupValue
column is split into three parts (Campaign_Core_activity.1
,Campaign_Core_activity.2
,Campaign_Core_activity.3
) based on the delimiter ” | “. This step allows you to handle campaigns with multiple parts or names.
- The
- Removing Unnecessary Split Columns:
- After splitting, the columns
Campaign_Core_activity.1
,Campaign_Core_activity.2
, andCampaign_Core_activity.3
are removed as they are not needed further.
- After splitting, the columns
- Renaming Columns:
- The column
ID
is renamed toObjectID
,Event.lookupValue
is renamed toName
, andCampaign:_CampaignId
is renamed toCampaignGuid
for consistency and clarity in the final dataset.
- Result Output:
- The transformed table is returned after all the necessary transformations are applied.
1 thought on “Marketing.Events”