Problems / Feature Availability Matrix / Editorial
MAX(CASE ...)
exports
MAX(CASE WHEN ... THEN 1 ELSE 0 END) is the presence pivot — the boolean sibling of the SUM(CASE) amount pivot. The mental model: CASE paints each row, the aggregate collapses the paint per group, and *which* aggregate you pick defines the semantics — SUM counts, MAX detects. Entity-attribute tables (features, permissions, tags) almost always want the MAX form.
MAX(CASE WHEN ... THEN 1 ELSE 0 END)
SUM(CASE)
Solve Feature Availability Matrix yourself →