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 total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,214,571
Messages
6,120,302
Members
448,954
Latest member
EmmeEnne1979

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
Back
Top