Lesson 3: Quarterly Revenue Analysis
Quarterly analysis helps understand how sales perform across different parts of the year. This is useful for identifying seasonal patterns and evaluating performance at a business-reporting level.
Code:
# Group sales by quarter and calculate total revenue
quarterly_revenue = df.groupby(['YEAR_ID','QTR_ID'])['SALES'].sum().reset_index()
quarterly_revenue
plt.figure(figsize=(8,4))
sns.barplot(
data=quarterly_revenue,
x='QTR_ID',
y='SALES',
hue='YEAR_ID'
)
plt.title("Quarterly Revenue by Year")
plt.xlabel("Quarter")
plt.ylabel("Total Sales")
plt.show()
Insights:
This visualization shows revenue distribution across quarters. Comparing quarters helps reveal recurring seasonal trends and supports planning for promotions, inventory, and sales targets.
Sales Data Analysis Project for Beginners Using Data Science
Jebasta








