select case
when date_trunc('year',block_timestamp) = '2022-01-01 00:00:00.000' then '2022'
when date_trunc('year',block_timestamp) = '2023-01-01 00:00:00.000' then '2023'
when date_trunc('year',block_timestamp) = '2024-01-01 00:00:00.000' then '2024'
end as "Year", to_char(block_timestamp, 'mon') AS "Month", case
WHEN "Month" = 'Jan' then 1
WHEN "Month" = 'Feb' then 2
WHEN "Month" = 'Mar' then 3
WHEN "Month" = 'Apr' then 4
WHEN "Month" = 'May' then 5
WHEN "Month" = 'Jun' then 6
WHEN "Month" = 'Jul' then 7
WHEN "Month" = 'Aug' then 8
WHEN "Month" = 'Sep' then 9
WHEN "Month" = 'Oct' then 10
WHEN "Month" = 'Nov' then 11
WHEN "Month" = 'Dec' then 12 end as month_num, count(distinct tx_id) as "Number of Transactions"
from axelar.core.fact_transactions
WHERE block_timestamp::date>='2022-01-01' and tx_succeeded='TRUE'
group by 1, 2, 3
order by 1, 3