Net Sales Variance Analysis between published view and base table.
Requirement
Requirements: Develop SQL logic to validate the decline in actual sales for the brand MESSIE by comparing two data sources Published View and the Base Financial Table. From the Published View (combined_sll_report_us), extract sales figures for MESSIE using the business by filter the data Brand = ‘MESSIE’, Time bucket = ‘CYTDW’, Source = ‘TTM’. Include only records where the ‘full_midnight_date’ is on or before March 31, 2025, as required by the published logic. From the Base Financial Table (r_t_1_finance_sll_week), pull financial sales for ‘MESSIE’ using operational filter the data by Brand = ‘MESSIE’, scenario like ACTUAL, Currency = USD, Country = US or USA, Year = 2024, Weekly records beginning with “Cal%”. After extracting data from both sources, calculate the total actual sales from each table and then compute the variance between them. Calculate the Variance as below formula
Variance = Published Total Sales − Base Total Sales
Expected output: Display the result.
Unity catalog: ‘combined_sll_report_us', 'r_t1_finance_sll_week’