feyikemiFlow Total Revenue
Updated 2024-05-08
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- Credit to Kruys-Collins and apostleoffinance their analysis on Revenue Growth was helpful in putting this together.
WITH q1_revenue_24 AS (
SELECT
DATE_TRUNC('day', block_timestamp_hour) AS day,
SUM(total_fees_usd) AS total_revenue
FROM
flow.stats.ez_core_metrics_hourly
WHERE
total_fees_usd IS NOT NULL
AND
DATE_PART('quarter', block_timestamp_hour) = 1
AND
DATE_PART('year', block_timestamp_hour) = 2024
GROUP BY
Day
),
revenue_with_lag AS (
SELECT
day,
total_revenue,
LAG(total_revenue) OVER (ORDER BY day) AS lagged_revenue
FROM
q1_revenue_24
),
Growth_Rate AS (
SELECT
total_revenue,
total_revenue - lagged_revenue AS revenue_growth,
(total_revenue - lagged_revenue) / Lagged_Revenue * 100 AS revenue_percentage_growth
FROM
revenue_with_lag
)
QueryRunArchived: QueryRun has been archived