Explore this snippet with some demo data here.
Timeseries charts show how individual metric(s) change over time. They have lines along the y-axis and dates along the x-axis. You just need a simple GROUP BY to get all the elements you need for a timeseries chart:
SELECT
AGG_FN(<COLUMN>) as metric,
<DATETIME_COLUMN> as datetime
FROM
<TABLE>
GROUP BY
datetime
where:
AGG_FN
is an aggregation function likeSUM
,AVG
,COUNT
,MAX
, etc.COLUMN
is the column you want to aggregate to get your metric. Make sure this is a numeric column.DATETIME_COLUMN
is the group you want to show on the x-axis. Make sure this is a date, datetime, timestamp, or time column (not a number)
In this example with some spotify data, we'll look at the total daily streams over time:
select
sum(streams) streams,
day
from PUBLIC.SPOTIFY_DAILY_TRACKS
group by day