Skip to content

How does the retention function calculate retention for multiple dates? #62126

@zhangmingchao

Description

@zhangmingchao

SELECT uid, retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r FROM retention_test WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') GROUP BY uid ORDER BY uid ASC
This sql only calculates the last two days of retention on the day of 2020-01-01, if you also want to calculate the last two days of retention on 2020-01-02?

SELECT uid, retention(date = '2020-01-01', date = '2020-01-02', date = '2020-01-03') AS r, retention(date = '2020-01-02', date = '2020-01-03', date = '2020-01-04') AS r2 FROM retention_test WHERE date IN ('2020-01-01', '2020-01-02', '2020-01-03') GROUP BY uid ORDER BY uid ASC
Do that?
Is there another way? I appreciate it very much!!!

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions