Forum Discussion
Calculate active users within a timeframe
- Anonymous2 years ago
Hi galgadot10 ,
I suggest you to create a calendar table to help your calculation.
Calendar = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Month",FORMAT([Date],"MMMM"),"MonthSort",MONTH([Date]))Data model:
Measure:
Count = CALCULATE ( DISTINCTCOUNT ( 'Table'[Member] ), FILTER ( ALL ( 'Table' ), 'Table'[Dates visited] <= MAX ( 'Calendar'[Date] ) && EOMONTH ( 'Table'[Dates visited], 3 ) >= MAX ( 'Calendar'[Date] ) ) )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi I've updated the description to be a little clearer and I hope that helps. I'm ideally looking for a more automated solution to work on json file with thousands of members so anything less manual would really help me out!
Also, I'd like Anna counted as an active member even when she hasn't had a session, because she's still registered with us. Do you have an alternative solution I could use in Power Bi please?
Hi galgadot10 ,
I suggest you to create a calendar table to help your calculation.
Calendar = ADDCOLUMNS(CALENDARAUTO(),"Year",YEAR([Date]),"Month",FORMAT([Date],"MMMM"),"MonthSort",MONTH([Date]))
Data model:
Measure:
Count =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Member] ),
FILTER (
ALL ( 'Table' ),
'Table'[Dates visited] <= MAX ( 'Calendar'[Date] )
&& EOMONTH ( 'Table'[Dates visited], 3 ) >= MAX ( 'Calendar'[Date] )
)
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.