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

Urgent help needed with weekly Cohort Report of user activities

I am looking to create a cohort report that captures what percentage of each cohort completes an activity each week. 

I have 2 data tables:

 

User Table (inactive relationships to the calendar table)

UserIDCohortCohort Start date
1A1/31/2020 
2A1/31/2020
3A1/31/2020 
4A1/31/2020
5B2/14/2020
6B2/14/2020
7B2/14/2020
8B2/14/2020
9B2/14/2020
10B2/14/2020
11B2/14/2020

 

UserActivity Table: (I only want to count Activity Status = 1) 

UserIDActivityStatusDate Updated
111/31/2020
112/1/2020
212/3/2020
312/3/2020
312/3/2020
212/11/2020
313/17/2020
512/17/2020
622/16/2020
722/16/2020

 

I would like a matrix that looks like this -- where you counting distinct userIDs for each week and counting what percent of the total cohort number have a status ID of 1 in that week:

CohortTotal at Start (Count of cohort)Cohort Start DateW1W2W3W4W5W6W7W8W9
A41/31/202025%50%25%0%0%0%0%25% 
B72/16/20200%14%0%0%0%    

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

- is there a way to make the weeknum column relative though? so week num 1 is 1/31 for Cohort A but is ALSO num 1 on 2/14 for Cohort B? 

 

Yes,create a calculated column as below:

 

Column = "w"& INT(DIVIDE(DATEDIFF( CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[Cohort]=EARLIER('Table'[Cohort]))),'Table'[Date],DAY),7)+1)

 

 

Finally you will see:

Annotation 2020-03-24 155756.png

 

Here is a demo you can refer to.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

View solution in original post

6 REPLIES 6
amitchandak
Super User
Super User

from the user, table take cohort and cohort start date and take a week from date dim joined to activity on col.

Anonymous
Not applicable

@amitchandak I get what you are saying, but not sure how to actually create that dimension. Is that a calculated column and then a measure counting unique IDs? Confusing given information is over 2 tables 

Greg_Deckler
Super User
Super User

So, you will need a week number column, use WEEKNUM then you could create a measure something along the lines of:

 

Measure =
  VAR __Count = COUNTROWS(FILTER('Table',[ActivityStatus] = 1))
  VAR __CountAll = COUNTROWS(ALL('Table'))
RETURN
  __Count / __CountAll

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler thanks - is there a way to make the weeknum column relative though? so week num 1 is 1/31 for Cohort A but is ALSO num 1 on 2/14 for Cohort B? 

Hi @Anonymous ,

 

- is there a way to make the weeknum column relative though? so week num 1 is 1/31 for Cohort A but is ALSO num 1 on 2/14 for Cohort B? 

 

Yes,create a calculated column as below:

 

Column = "w"& INT(DIVIDE(DATEDIFF( CALCULATE(MIN('Table'[Date]),FILTER('Table','Table'[Cohort]=EARLIER('Table'[Cohort]))),'Table'[Date],DAY),7)+1)

 

 

Finally you will see:

Annotation 2020-03-24 155756.png

 

Here is a demo you can refer to.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!

I can't really think of a way given your current data structure. Unless perhaps you created a column in your table like:

 

Column = LOOKUPVALUE('Table1'[Cohort],'Table1'[UserID],'Table2'[UserID])

 

Then perhaps something like:

 

Count Column = COUNTROWS(FILTER('Table2',[Date Updated] <= EARLIER([Date Updated] && [ActivityStatus] = 1 && [Column] = EARLIER([Column])))


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.