Query editor
-- Monthly cumulative line + latest Counter from the same resultWITH parsed AS (SELECT CAST(json_parse(http_get('https://data.crestal.network/api/card/1024/query/json')) AS array(json)) AS arr),points AS (SELECTfrom_iso8601_timestamp(json_extract_scalar(e, '$["Created At"]')) AS ts,TRY_CAST(json_extract_scalar(e, '$["Cumulative Count"]') AS BIGINT) AS cumulativeFROM parsedCROSS JOIN UNNEST(arr) AS t(e)WHERE json_extract_scalar(e, '$["Created At"]') IS NOT NULL),monthly AS (-- take the last reading in each monthSELECTCAST(date_trunc('month', ts) AS date) AS month,max_by(cumulative, ts) AS cumulative_month_endFROM pointsGROUP BY 1)SELECTmonth,cumulative_month_end AS cumulative_count, -- use for the line (monotonic)MAX(cumulative_month_end) OVER () AS latest_cumulative -- use for the CounterFROM monthlyORDER BY month DESC