SELECT date, sum(address) OVER (ORDER BY date) AS cumulative_sum
FROM (
SELECT date, count(signer) as address FROM (
SELECT * FROM (
SELECT
arrayJoin(
arrayMap(
x -> toDateTime(x),
range(
toUInt32(toDateTime('2021-02-18 12:00:00')),
toUInt32(now()),
3600
)
)
) as date
) date
LEFT JOIN (
SELECT signer, MAX(timestamp_start_of_hour) + INTERVAL 1 YEAR as timestamp_start_of_hour FROM (
SELECT toStartOfHour(timestamp) as timestamp_start_of_hour, signer FROM spacebox.`transaction`
LEFT JOIN spacebox.block ON `transaction`.height = block.height
) as t
GROUP BY signer
ORDER BY timestamp_start_of_hour
) au ON date.date = au.timestamp_start_of_hour
ORDER BY date DESC
)
WHERE signer != ''
GROUP BY date
ORDER BY date
)
@iljagrabar14