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 Eventstable. - 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_datefield. 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_Keycolumn is transformed to thedatedata type for consistency and easy date-based analysis.
- The
- Unpivoting Columns:
- All columns except the
ID,Date_Key,Event.lookupValue,Campaign.lookupValue, andCampaign:_CampaignIdcolumns 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 theValuecolumn.
- All columns except the
- Adding Platform Information:
- A new column
Platformis 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
SourcesTypeis added with the value “Events”, marking this data source as event-related.
- Another column
- Splitting Campaign Name by Delimiter:
- The
Campaign.lookupValuecolumn 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.3are removed as they are not needed further.
- After splitting, the columns
- Renaming Columns:
- The column
IDis renamed toObjectID,Event.lookupValueis renamed toName, andCampaign:_CampaignIdis renamed toCampaignGuidfor 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”