Measure to count absences by calendar month, based on start date and end date range

aldousjg

New Member
Joined
Jan 20, 2021
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I need to create a measure that shows the count of absences that occurred in each calendar month. For an absence to count as "occurring" either the start date of that absence or the end date of that absence can be in the month.

I have two tables:

1) Calendar table created in DAX with Date column, Month column, Year column, and YearMonth column with year and month concatenated (eg 2021.6).
2) Absences table with one row per absence (unique identifier of absence number) and start date and end date columns amongst other things.

Example:

Absence No. Start Date End Date
1 01/06/2021 05/06/2021
2 29/06/2021 03/07/2021
3 25/05/2021 12/06/2021
4 01/07/2021 02/07/2021

The measure should return a count of 3 for June 2021 from the example data, as absences 1, 2 and 3 count and each absence should only be counted once even if both start and end date are in the month.

Could anyone help with this?

Thank you,
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,115
Messages
5,768,205
Members
425,459
Latest member
Danniey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top