Marketing.SocialMedia

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:

Changing Data Types:

  • The PublishDate column is first transformed into the datetime data type, and then converted into the date 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 of 0 for all rows.

Unpivoting Data:

  • All columns except CampaignGuid, CampaignId, CreatedBy, Id, Name, PublishDate, Type, and Url are unpivoted. This means the other columns are converted into two new columns:
    • Attribute (which contains the original column names) and
    • Value (which holds the corresponding data).

Removing Unnecessary Columns:

  • The Url and CreatedBy 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 to Date_Key for consistent naming conventions.
  • The Type column is renamed to SourcesType 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.

Leave a Comment