Skip to content

Calculates retention for a set of events. Returns an array of 0s and 1s.

func.retention(cond1, cond2)
func.retention(get_column(table, 'day1'), get_column(table, 'day2'))
RETENTION(cond1, cond2)
SELECT uid, RETENTION(dt='2024-01-01', dt='2024-01-02', dt='2024-01-03')
FROM events GROUP BY uid;
┌─────┬────────────┐
uidretention
├─────┼────────────┤
1 │ [1,1,0] │
2 │ [1,0,0] │
3 │ [1,1,1] │
└─────┴────────────┘