Advance Analytics on Sales data
Requirement
Introduction: Sales data analysis often requires detailed insights using window functions to perform advanced analytics on sales data. Ranking the products by sales within each region and calculate the percentage change in sales across consecutive quarters for each product. These insights help identify top-performing products and trends over time, enabling better decision-making in the sales.
Requirements:
Create the Pyspark code and use the source table ‘sales_window'.
* Ranking: Rank the products by sales amount in descending order within each region.
* Sales_trends: Calculate percentage change in sales between consecutive quarters by product, region, quarter with sales table. Add the column of 'Previous_Quarter_Sales','Sales_Percentage_Change'.
* Final Output: Display the results of Ranking and also show the results of Sales_trends separately. Display the Final result as join both Ranking and Sales_trends.
Unity Catalog: purgo_playground.sales_window