Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Count activity per Day

Hello everybody,

 

I have this kind of table with two columns : userId and date Time of activity : 

userIdactivity date/time
id114/01/2021 06:52
id104/01/2021 07:47
id104/01/2021 07:26
id223/12/2020 19:05
id217/12/2020 14:24
id213/12/2020 15:23
id322/12/2020 21:05
id322/12/2020 17:52
id316/12/2020 20:38
id315/12/2020 15:43
id311/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 : 

userIdactivity date/timenbr activity per day
id114/01/2021 06:521
id104/01/2021 07:472
id104/01/2021 07:262
id223/12/2020 19:051
id217/12/2020 14:241
id213/12/2020 15:231
id322/12/2020 21:052
id322/12/2020 17:522
id316/12/2020 20:381
id315/12/2020 15:431
id311/12/2020 15:171

 

Any idea please to do that ? Thank you for your help.

 

Best,

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@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]))

View solution in original post

Tahreem24
Super User
Super User

@Anonymous ,

First create Calculated column to extract only Date part from Activity Datetime Column:

Date Column = FORMAT(Master[activity date/time],"DD/MMM/YYYY")
 
Then Create measure to count based on newly created Date Column:
Measure = CALCULATE(COUNT(Master[userId]),ALLEXCEPT(Master,Master[Date Column]))
 
Screen shot attached:
Capture.PNG
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

View solution in original post

2 REPLIES 2
Tahreem24
Super User
Super User

@Anonymous ,

First create Calculated column to extract only Date part from Activity Datetime Column:

Date Column = FORMAT(Master[activity date/time],"DD/MMM/YYYY")
 
Then Create measure to count based on newly created Date Column:
Measure = CALCULATE(COUNT(Master[userId]),ALLEXCEPT(Master,Master[Date Column]))
 
Screen shot attached:
Capture.PNG
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
amitchandak
Super User
Super User

@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]))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.