Forum Discussion
Anonymous
3 years agoNot applicable
Count values in specified date range
Hello, I'm trying to create a table similar to the below: I am having some issues counting the values in between a specific date range. I tried using the function DATESBETWEEN to count the...
Anonymous
3 years agoNot applicable
Hi Neeko,
Thank you for your response! That seemed to work, however I have two different date ranges I have to account for:
1/1/2015 - 6/30/2019
7/1/2019 - Present
How can I account for both date ranges with a single calendar table? The solution you provided would account for a single date range at a time.
Thank you!
Anonymous
3 years agoNot applicable
Hi Anonymous ,
According to your description, here are my steps you can follow as a solution.
(1) This is my test data.
(2) We can create two measures.
Pre-Intervention Incident Count (1/1/2015 - 6/30/2019) =
SUMX (
SUMMARIZE (
'ReportTable',
'ReportTable'[report_no],
"_1",
COUNTX (
FILTER (
'ReportTable',
'ReportTable'[date] >= DATE ( 2015, 1, 1 )
&& 'ReportTable'[date] <= DATE ( 2019, 6, 30 )
),
'ReportTable'[report_no]
)
),
[_1]
)
Pre-Intervention Incident Count (7/1/2019 - Present) =
SUMX (
SUMMARIZE (
'ReportTable',
'ReportTable'[report_no],
"_1",
COUNTX (
FILTER (
'ReportTable',
'ReportTable'[date] >= DATE ( 2019, 7, 1 )
&& 'ReportTable'[date] <= TODAY ()
),
'ReportTable'[report_no]
)
),
[_1]
)
(3) Then the result is as follows.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.