Problems / Percentage of Total / Editorial
department
SUM(amount)
A scalar subquery (SELECT SUM(amount) FROM sales) computes the grand total once and makes it available to every row.
(SELECT SUM(amount) FROM sales)
Compute the grand total as a one-row DataFrame, then crossJoin it so every grouped row can reference it.
crossJoin
Solve Percentage of Total yourself →