Aggregation Grain Cards
Recall the grain and aggregate checks that prevent double-counting.
battlecard comparison What question should you answer before GROUP BY? One output row equals what? The answer should match the GROUP BY expressions. Grain COUNT(*) vs COUNT(column) vs COUNT(DISTINCT column) Name the counted entity before choosing. AVG(discount_pct) is the average discount, right? Say this It is the average discount at the current row grain. If rows are line items, line items get equal weight. AVG hides a weighting assumption. It moves the conversation from function name to metric meaning. What is the safest response to a doubled SUM after a join? Check join cardinality and restore the intended grain before…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in