top of page
Create Weekly KPI Rollup at Market level With Customer and Product Filters
Requirement
Requirement: Develop SQL Logic, Read sales data from the table stitched_market_kpi_data. Filter by product_name = 'REPATHA', market_name = 'US_CARDIO', customer_type IN ('HCP', 'CLINIC'), metric_name IN ('TRx', 'NRx'), week_start_date ≥ '01-09-2023'(DD-MM-YYYY Format), For all valid records, compute the weekly KPI by aggregating metric_value using SUM(metric_value) grouped by market_name, product_name, week_start_date, metric_name. The final output should return the following columns market_name, product_name, week_start_date, metric_name, total_metric_value.
Expected Output: Display the result.
Unity Catalog: stitched_market_kpi_data
Purgo AI Agentic Code
bottom of page