Forum Discussion
Count events between two dates
- Anonymous3 years ago
This piece of code solved my problem:
COUNTROWS(FILTER(ALL(Data), MAX('Calendar'[Date]) > [EventStart] && MAX('Calendar'[Date]) < [EventEnd]))
Hi,
I am not sure if I understood your question correctly, but I tried to create a sample pbix file like below.
Please check the below picture and the attached pbix file.
Active events count: =
COUNTROWS (
FILTER (
Data,
Data[EventEnd] >= MIN ( 'Calendar'[Date] )
&& Data[EventStart] <= MAX ( 'Calendar'[Date] )
)
)
- Anonymous3 years agoNot applicable
This piece of code solved my problem:
COUNTROWS(FILTER(ALL(Data), MAX('Calendar'[Date]) > [EventStart] && MAX('Calendar'[Date]) < [EventEnd])) - Anonymous3 years agoNot applicable
I might not have expressed myself clearly, so I'll try again (thanks for the feedback):
In your example, in April 2022 your measure results in the number 3, however, it should've returned 9, because there are nine IDs that match my criteria, i.e., that started before April 30, 2022 and ended after April 30, 2022.
EventStart date filter:
EventEnd date filter:
Do you know what I should edit in order to achieve this result?
Thanks in advance.
- Hanss1 year agoNew Member
Hi, is it possible in this example to count, how many and what ID's was active in each month ? To get table like this:
Month-Year ID's Active ID's Jan-2021 32967 2 Jan-2021 64315 1 Feb-2021 32967 4 Mar-2021 40415 9 I will be grateful for your answer