If you don't have any foreign keys referencing that table (i.e. "incoming" foreign keys), you could do something like this:
-- save the squashed data into a temporary table
create temp table new_data as
SELECT min(date) as date, user_id, sum(usd_value) as usd_value, sum(eur_value) as eur_value
GROUP BY date_trunc('hour', date), user_id;
-- get ...
Thank you for your prompt reply Akina.
MONTH | INCOME | EXPENSES | DIFFERENCE
where INCOME represents the sum for all positive values
and EXPENSES represents the sum for all negative values
I have tried the bellow
SELECT MONTH(transactiondate) `MONTH`,
SUM(CASE when amount <0 then amount END) EXPENSES ,...