I would like to count the number of days that users have logged in over a period of time and then group the results by the number of days logged in so I can create a power user curve.
My table looks like this:
user_id | event | date
1 | login | 2022-01-01 14:30
1 | login | 2022-01-01 15:30
2 | login | 2022-01-02 09:00
1 | login | 2022-01-02 11:59
1 | login | 2022-01-03 12:34
I created the following table below but it is not what I wanted:
user_id | No. of days logged in
1 | 3
2 | 1
I would like to create a table like this instead:
No. of days | No. of Users
1 | 1
2 | 0
3 | 1
I have tried using the distinct count over function like so: distinctCountOver({extract(‘DD’, {date}), [{user_id}], PRE_AGG)