Forum Discussion
PaulG572
7 years agoNew Member
Count rows based on dates from 2 separate tables
Hi community, I am struggling to create a calculated column that counts activities per account between dates from different tables and was wondering if anyone can help? The table schemas are as b...
- Anonymous7 years ago
[# Activities (30D)] = -- column in tblAccounts var __daysDiff = 30 var __daysOpen = tblAccounts[DaysOpen] var __account = tblAccounts[AccountID] var __openDate = tblAccounts[OpenDate] var __endDate = __openDate + __daysDiff var __activityCount = COUNTROWS( FILTER ( tblActivities, tblActivities[AccountID] = __account && tblActivities[Date] >= __openDate && tblActivities[Date] <= __endDate ) ) RETURN if( __daysOpen >= __daysDiff, __activityCount )
Best
D.
Anonymous
7 years agoNot applicable
[# Activities (30D)] = -- column in tblAccounts var __daysDiff = 30 var __daysOpen = tblAccounts[DaysOpen] var __account = tblAccounts[AccountID] var __openDate = tblAccounts[OpenDate] var __endDate = __openDate + __daysDiff var __activityCount = COUNTROWS( FILTER ( tblActivities, tblActivities[AccountID] = __account && tblActivities[Date] >= __openDate && tblActivities[Date] <= __endDate ) ) RETURN if( __daysOpen >= __daysDiff, __activityCount )
Best
D.
PaulG572
6 years agoNew Member
Anonymous many apologies I thought i'd already thanked you for this, so at last thank you it worked a treat