Revenue and Interaction Metrics: HCP Conversion Analysis
Requirement
Introduction: This analysis aims to evaluate the effectiveness of different interaction types used by Healthcare Professionals (HCPs) in converting client engagements into sales revenue. By analyzing these metrics, organizations can gain insights into which interaction types (e.g., calls, emails, meetings) are most effective in driving revenue, enabling data-driven decision-making and resource optimization.
Requirements:
Read the table 'hcp_interaction'
Group the data by interaction types and calculate the interactions by count of all interactions, sum of Sales_Amount for each interaction type, sum of interactions(Revenue_Converted = Yes) that resulted in (Revenue_Converted_Count). Revenue_Converted divided by Total_Interactions multiply by 100. And order by in descending order of Conversion_Rate_Percentage.
Final Output: Show the result of Interaction type wise total interactions, total sales, revenue conversion count, conversion rate percentage.
Write the pyspark code without syntax error.
Unity Catalog: hcp_interaction