# Calculate utilization days in a given month from a start date and end date (Or timeline)

Hello there! Looking for help with the following scenario that I can’t manage to even get a good start on how to solve it. I’m trying to calculate usage of a work vessel for a given month within a timeline. Example:

Four columns on a Monday.com board: Timeline, Duration,June Days and July Days.

In Make, you can grab the start date and end date from the timeline, so that’s no big deal. What I want to happen is when the user adjusts the timeline in Monday, Make will run a scenario that puts the number of days in June that are included in the June Days column and the number of days in July that are included in the July days column. I can’t come up with a way to solve this one. Any ideas?

Hello Brian,

Here is how I might approach this, it’s complicated so I’m hoping someone else has a less complicated method…

1. Use a repeater (starting at 0, ending at 364) combined with a JSON aggregator to create a collection of date objects starting from your starting date
Use a filter to stop adding items when the date exceeds the range end date.
Each object should contain data points like date, month, day, year, day of week, name of month, etc… whatever you need to help filter, which is this name is name of Month.
2. Parse the JSON
3. Aggregate JSON into a single array
4. Iterate on the list of Name of Month in the array.
5. Use map to query the array, create an array of dates for each month, counting the days in each month.

Here’s what I started with:

And result:

The end is one Operation for each month included in the range, which in this case is 2, June and July. In your scenario you wouldn’t need this, it’s just for illustration.

I’ll post this blueprint, but you’ll need to build your own JSON Data Structure for it to work correctly. Here’s sample data to use for the Data Structure:

``````  {
"Day": 21,
"Date": "2024-06-21T15:06:00.000Z",
"Year": 2024,
"Month": 6,
"Month Name": "June",
"Is Weekend?": false,
"Day of Week Name": "Friday"
}

``````

Blueprint: JuneJulyDays.json (14.1 KB)

1 Like