V1.2 - Targeted Customers

VW_TARGETED_AND_EXCLUDED_CUSTOMERS (v1.2)

-- FOR V1.2
SELECT *
FROM [SHARED_DB].[BI].[VW_TARGETED_AND_EXCLUDED_CUSTOMERS_V1_2]

Overview

This view provides an organized representation of customers who were either targeted or excluded from scheduled campaigns. It includes details about the campaigns, customers, and reasons for exclusion if applicable. The structure remains consistent for easy integration with additional tools and queries.

Useful Queries

  • Which customers were excluded from a specific campaign and why?

    • This query helps identify the customers who were excluded from certain campaigns' occurences and the reason behind their exclusion.
    SELECT 
        CUSTOMER_ID,
        PLAN_ID,
        PLAN_DETAIL_ID,
        CAMPAIGN_ACTION_NAME,
        EXCLUSION_REASON,
        EXCLUSION_REASON_DESC,
        EXECUTION_DATE
    FROM 
        BI.VW_TARGETED_AND_EXCLUDED_CUSTOMERS
    WHERE 
        EXCLUSION_REASON IS NOT NULL
    ORDER BY 
        EXECUTION_DATE DESC;
    
    
    • This query retrieves customers who were eventually targeted by certain campaigns occurences
    SELECT 
        CUSTOMER_ID,
        PLAN_ID,
        PLAN_DETAIL_ID,
        CAMPAIGN_ACTION_NAME,
        EXCLUSION_REASON,
        EXCLUSION_REASON_DESC,
        EXECUTION_DATE
    FROM 
        BI.VW_TARGETED_AND_EXCLUDED_CUSTOMERS
    WHERE 
        EXCLUSION_REASON IS NULL  -- Customers who were targeted but not excluded
    ORDER BY 
        EXECUTION_DATE DESC;
    
    

  • Which lifecycle stage were customers in during campaign execution?

    • Helps understand customer behavior and campaign effectiveness based on their lifecycle stage.

Table Description (Updated)

Field NameDescriptionData TypeFormat
EXECUTION_DATEDate when the campaign was executedDateYYYY-MM-DD
CUSTOMER_IDUnique identifier for the customerString
LIFECYCLE_STAGEThe stage of the customer within the lifecycle when the campaign was executedString
PLAN_IDUnique identifier for the campaign planInteger
PLAN_DETAIL_IDUnique identifier for the specific detail within the campaign planInteger
CAMPAIGN_ACTION_NAMEName of the campaign actionString
TAKEN_FROM_PLAN_IDPlan ID from which the campaign action was taken. If NULL, this is the plan the customer was targeted withInteger
EXCLUSION_REASON_IDUnique identifier for the reason a customer was excluded from the campaignInteger
EXCLUSION_REASONThe exclusion reasonString
EXCLUSION_REASON_DESCA detailed description of why the customer was excludedString
LAST_UPDATED_TIMEThe timestamp of the last update to this recordDateTimeYYYY-MM-DD HH:MM

Key Changes (Version Update):

  • ACTION_NAME is now CAMPAIGN_ACTION_NAME to better align with campaign-related tables.
  • Other column names remain the same, with minor formatting adjustments for consistency and clarity.