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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.