Forum Discussion
People active during Date Range
- 2 years ago
Number of Active People = VAR _selDateMin = MIN('Date'[Date]) VAR _selDateMax = MAX('Date'[Date]) RETURN CALCULATE ( DISTINCTCOUNT ( 'Table'[id] ), FILTER ( 'Table', 'Table'[enrollment_start] <= _selDateMax && ( 'Table'[enrollment_end] >= _selDateMin || ISBLANK ( 'Table'[enrollment_end] ) ) ) )This was the fix for this. It allows me to filter anyone that was active at some time during this time. This was largely thanks to you but this was the actual solution. I just needed to account for the MIN and MAX.
Thank you for all of your help Anonymous
Number of Active People =
VAR _selDateMin = MIN('Date'[Date])
VAR _selDateMax = MAX('Date'[Date])
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Table'[id] ),
FILTER (
'Table',
'Table'[enrollment_start] <= _selDateMin || 'Table'[enrollment_start] < _selDateMax
&& (
'Table'[enrollment_end] >= _selDateMax || 'Table'[enrollment_end] >= _selDateMin
|| ISBLANK ( 'Table'[enrollment_end] )
)
)
) I tried tweaking it a bit, but it seems to still ignore the minimum date, but I feel like this might make more sense to what I'm trying to do?
Number of Active People =
VAR _selDateMin = MIN('Date'[Date])
VAR _selDateMax = MAX('Date'[Date])
RETURN
CALCULATE (
DISTINCTCOUNT ( 'Table'[id] ),
FILTER (
'Table',
'Table'[enrollment_start] <= _selDateMax
&& (
'Table'[enrollment_end] >= _selDateMin
|| ISBLANK ( 'Table'[enrollment_end] )
)
)
) This was the fix for this. It allows me to filter anyone that was active at some time during this time. This was largely thanks to you but this was the actual solution. I just needed to account for the MIN and MAX.
Thank you for all of your help Anonymous
- Anonymous2 years agoNot applicable
Hi tagban ,
It's glad to hear that your problem has been resolved. Thanks for sharing your solution here. Could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours. Thank you.
Best Regards