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 begins by loading data from the
hbs SocialPoststable. - myBMT (bmt-dwh-uks-app-my.azurewebsites.net)
Changing Data Types:
- The
PublishDatecolumn is first transformed into thedatetimedata type, and then converted into thedatedata type for more consistent handling of dates.
Adding a Custom Column:
- A new column called
Custom1is added to the table, with a default value of0for all rows.
Unpivoting Data:
- All columns except
CampaignGuid,CampaignId,CreatedBy,Id,Name,PublishDate,Type, andUrlare unpivoted. This means the other columns are converted into two new columns:Attribute(which contains the original column names) andValue(which holds the corresponding data).
Removing Unnecessary Columns:
- The
UrlandCreatedBycolumns are removed, as they are not necessary for this analysis.
Adding a Platform Column:
- A new column named
Platformis added to indicate that the data source is “Social Media” for all rows.
Renaming Columns:
- The
PublishDatecolumn is renamed toDate_Keyfor consistent naming conventions. - The
Typecolumn is renamed toSourcesTypeto better reflect its role as the source type for the social media data.
Result Output:
- The final table, with all transformations and new columns, is returned as the output of the query.