Customer_360 - Restrict Sales Data by Valid Market–Product–BU and Filter Non-Restricted Customers
Requirement
Introduction: In C360 Life Science Sales Data Pipeline, the table c360_s_field_reporting_sales_customer_pivot holds transactional sales records from multiple business units (BUs), markets, and products. However, not all Market–Product–BU combinations are approved for reporting, and some customer records are marked as restricted, which should be excluded from analytics. This Ensuring only valid Market–Product–BU combinations (from c360_bu_role_market_restriction) are used. Removing restricted customers to comply with reporting policies. Keeping only valid time buckets for weekly and cumulative analysis. The resulting filtered dataset becomes the foundation for all downstream C360 dashboards such as Customer–Brand–Payer claims, sales performance, and growth trend visualizations.
Requirements: Develop the SQL logic, load the “c360_s_field_report_sales_customer_pivot”, “c360_bu_role_market_restriction“. Perform join between sales data and restriction table using lower-case, trimmed comparisons on business_unit_code, market_name, and product_level. Exclude all customer_id that contain "restricted"(case insensitive). Keep only records where time_bucket_id is (W1–W26, C4W, C13W, C26W, C52W).
Final Output: Display the Result.
Unity Catalog: “c360_s_field_report_sales_customer_pivot”, “c360_bu_role_market_restriction“