Found a solution…
Using the example shown in the very next line:
Payment
|> where([c], c.customer_id == ^options[:customer_id])
|> select([c], %{
count: count(),
sum: sum(c.payment_in_cents),
bucket: selected_as( [...]
gives
[
%{count: 2, sum: 200, bucket: 5},
%{count: 2, sum: 205, bucket: 7},
%{count: 2, sum: 200, bucket: 9}
]


















