Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello everybody,
I have this kind of table with two columns : userId and date Time of activity :
userId | activity date/time |
id1 | 14/01/2021 06:52 |
id1 | 04/01/2021 07:47 |
id1 | 04/01/2021 07:26 |
id2 | 23/12/2020 19:05 |
id2 | 17/12/2020 14:24 |
id2 | 13/12/2020 15:23 |
id3 | 22/12/2020 21:05 |
id3 | 22/12/2020 17:52 |
id3 | 16/12/2020 20:38 |
id3 | 15/12/2020 15:43 |
id3 | 11/12/2020 15:17 |
That, I want to add a column with the number of activity per day for each user, look the table below :
userId | activity date/time | nbr activity per day |
id1 | 14/01/2021 06:52 | 1 |
id1 | 04/01/2021 07:47 | 2 |
id1 | 04/01/2021 07:26 | 2 |
id2 | 23/12/2020 19:05 | 1 |
id2 | 17/12/2020 14:24 | 1 |
id2 | 13/12/2020 15:23 | 1 |
id3 | 22/12/2020 21:05 | 2 |
id3 | 22/12/2020 17:52 | 2 |
id3 | 16/12/2020 20:38 | 1 |
id3 | 15/12/2020 15:43 | 1 |
id3 | 11/12/2020 15:17 | 1 |
Any idea please to do that ? Thank you for your help.
Best,
Solved! Go to Solution.
@Anonymous , Create a date column from datetime and then try this column
countx(filter(Table, [userId] = earlier([userId]) && [date] = earlier([date])),[userId])
date columns
Date = [datetime].date
or
Date = date(year([datetime]),month([datetime]),day([datetime]))
@Anonymous ,
First create Calculated column to extract only Date part from Activity Datetime Column:
@Anonymous ,
First create Calculated column to extract only Date part from Activity Datetime Column:
@Anonymous , Create a date column from datetime and then try this column
countx(filter(Table, [userId] = earlier([userId]) && [date] = earlier([date])),[userId])
date columns
Date = [datetime].date
or
Date = date(year([datetime]),month([datetime]),day([datetime]))
User | Count |
---|---|
93 | |
85 | |
78 | |
68 | |
62 |
User | Count |
---|---|
113 | |
99 | |
96 | |
64 | |
58 |