How do we compute order count, gross sales, and average ticket size simultaneously in one pass?
Passing multiple aggregate expressions into select() to perform comprehensive statistical profiling.
Daily KPI snapshots, executive summary cards, and business health monitoring.
from pyspark.sql.functions import avg, col, count, sum
df.select(
count(col("order_id")).alias("order_count"),
sum(col("amount")).alias("gross_sales"),
avg(col("amount")).alias("avg_ticket_size")
).show()Practice typing production-grade PySpark code for Multi-Metric Aggregate Calculations.