top of page

Product ranking based on revenue

Requirement

Information: Ranking products by revenue helps identify the top-performing products in the market. This insight allows for increased production of high-performing products, ultimately driving revenue growth.

 

Requirement:

Develop a PySpark code to rank product_type by revenue for each country, using data spanning 12 months from the purchased_date column. Additionally, create a new column called performance in dataframe to evaluate the consistency of each product_type over the 12-month period based on the following criteria:

 

Gold:* Ranked among the top 3 for ≥ 6 months.

Silver:* Ranked among the top 3 for ≥ 3 and < 6 months.

Bronze:* Ranked among the top 3 for < 3 months.

 

Display the following columns as output:

product_type, country, no_of_months_in_top3, performance

 

Unity Catalog information: purgo_playground.d_product_revenue

Purgo AI Agentic Code

bottom of page