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 SocialPosts
table. - myBMT (bmt-dwh-uks-app-my.azurewebsites.net)
Changing Data Types:
- The
PublishDate
column is first transformed into thedatetime
data type, and then converted into thedate
data type for more consistent handling of dates.
Adding a Custom Column:
- A new column called
Custom1
is added to the table, with a default value of0
for all rows.
Unpivoting Data:
- All columns except
CampaignGuid
,CampaignId
,CreatedBy
,Id
,Name
,PublishDate
,Type
, andUrl
are 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
Url
andCreatedBy
columns are removed, as they are not necessary for this analysis.
Adding a Platform Column:
- A new column named
Platform
is added to indicate that the data source is “Social Media” for all rows.
Renaming Columns:
- The
PublishDate
column is renamed toDate_Key
for consistent naming conventions. - The
Type
column is renamed toSourcesType
to 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.