Marketing.EmailCampaigns

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:

Adding a Custom Column:

  • A new column named Custom1 is added to the table, with a value of 0 for all rows.

Unpivoting Data:

  • The query unpivots all columns except for CampaignGuid, CampaignId, FromEmail, Id, Name, SentBy, Subject, SentByEmail, From, EmailType, and SendDate.
  • This results in two new columns:
    • Attribute (original column names) and
    • Value (corresponding values).

Changing Data Types:

  • The SendDate column is first converted into the datetime data type and then changed into the date data type for easier date-based analysis.

Renaming Columns:

  • The SendDate column is renamed to Date_Key for consistency with other queries.

Removing Unnecessary Columns:

  • The following columns are removed as they are not needed for this specific analysis: FromEmail, From, SentBy, SentByEmail, Subject, and EmailType.

Adding a Platform Column:

  • A new column named Platform is added to indicate that the data comes from “Email Campaigns” for all rows.

Adding a Source Type Column:

  • A column named SourcesType is added to specify the source as “Email” for each row.

Result Output:

  • The final table is output after all transformations and new columns are applied.

Leave a Comment