We have a problem where we are using a case when statement to derive columns with aggregated buckets.
When we try and group the buckets into case numbers, it groups the entire count of case numbers into a single bucket. Rather than splitting the data into multiple different buckets.
CODE USED------------------
CASE WHEN
SUM (
CASE WHEN "TABLE"."ABC"='A'
AND ACTIVITY_LEAD (CASE
WHEN ("TABLE"."ABC" IN ('B'))
THEN "TABLE"."ABC"
ELSE NULL END) IS NULL
THEN 1 ELSE 0
END
) between 1 and 5 then '1 TO 5' ELSE '6+' END