Cathy Liu
04/29/2026, 6:10 AMkapa.ai
04/29/2026, 6:10 AMCASE WHEN on {fact/recency_days} to define recency buckets. While COUNT in MAQL already returns distinct values by default (no separate DISTINCT keyword is needed), combining CASE WHEN with a distinct count per group in a single metric is not directly supported — CASE does not work at the base data level and evaluates on the aggregation dimension, meaning you cannot do COUNT(DISTINCT player_id) WHERE CASE WHEN ... in a single MAQL metric. [CASE statement] Recommended Approaches 1. Precompute the recency group (most robust) Add a recency_group column (e.g., "<30", "31-90", "91-365", "Year+") at the ETL/SQL level or via a SQL Dataset in GoodData. Then simply use:
SELECT COUNT({label/player_id})
...sliced by the recency_group attribute in a table visualization. GoodData will automatically return the distinct count of player_id per group. [CASE statement] 2. Separate metrics per bucket (MAQL-only workaround) If you need to keep the logic purely in MAQL, create separate metrics for each recency bucket using a WHERE condition, and display them side by side in a visualization. This avoids the dynamic grouping limitation but requires one metric per bucket.
The precomputed attribute approach is the recommended pattern for bucketing use cases in GoodData Cloud, as it sidesteps the MAQL CASE limitation entirely and keeps your metrics maintainable. [CASE statement] 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups.
👀 Our Support team monitors all messages and will jump in if needed.Joseph Heun
04/29/2026, 8:04 AMCathy Liu
04/30/2026, 12:08 AMJoseph Heun
04/30/2026, 8:40 AMJoseph Heun
04/30/2026, 8:40 AM