Forum Discussion

jen8080's avatar
jen8080
Helper I
5 years ago

Help! Dynamic measure based on start and end dates!

I'm trying to figure out how to spread the requested hours for a project over the length of that project with a known start and end date. I need it to be dynamic enough to understand if it started mid-month it would then have less hours then if it was a full month.

 

The end goal is to get a forecast of how many hours we expect in each month for all the projects we have to determine the overall capacity demands for the month. So we'd have something like a bar chart that shows the total hours demand for each month based on the projects that will impact that month. 

 

Example: requested hours is 80 the estimated work start date in 15-Jun-20 and Estimated work end date is 24-Aug-20 the measure would span the requested hours our accordingly.

Jun-20

Jul-20

Aug-20

19

35

26

 

Notes:

1. I have already created a separate date table called "Calendar" with these columns

Calendar = CALENDAR(MIN(report[Estimated Work Start Date]),MAX(report[Estimated Work End Date]))

MONTHYEAR = MONTH('Calendar'[Date])/10+YEAR('Calendar'[Date])

 

2. I already have a measure that spans data out evenly per month  vs what I need which is for it to be dynamic based on dates

Measure 2 = SUMX(VALUES('Calendar'[MONTHYEAR]),CALCULATE(SUM(report[HoursPerMonth]),FILTER('report',var a = 'report'[Estimated Work Start Date]var b = 'report'[Estimated Work End Date] return MONTH(a)/10+YEAR(a)<= MAX('Calendar'[MONTHYEAR])&&MONTH(b)/10+YEAR(b)>= MAX('Calendar'[MONTHYEAR]))))

 

3.. Each project can have multiple requested hours (that’s why the same project is listed multiple times)

I have a dynamic key get a unique ID by row

 

4. I cannot share the data it is sensitive but I have created a sample set below

ProjectRequested HoursEstimated Work End DateEstimated Work Start DateWork Start Vs Work End DaysRequested Hours per DayHoursPerMonthKEY
Project 1743.730-Apr-2131-Jul-202742.7174.37Key 1
Proejct 26019-Jun-201-Jun-20193.1660Key 2
Project 31381-Jan-211-Jun-202150.6417.25Key 3
Project 41020-Aug-2122-Jun-204250.020.67Key 4
Project 4220-Aug-2122-Jun-2042500.13Key 5
Project 57212-Oct-2027-Jul-20780.9218Key 6
Project 59012-Oct-2027-Jul-20781.1522.5Key 7
Project 54012-Oct-2027-Jul-20780.5110Key 8
Project 54812-Oct-2027-Jul-20780.6212Key 9
Project 52412-Oct-2027-Jul-20780.316Key 10
Project 539012-Oct-2027-Jul-2078597.5Key 11 
Project 51612-Oct-2027-Jul-20780.214Key 12 
Project 5412-Oct-2027-Jul-20780.051Key 13
Project 5812-Oct-2027-Jul-20780.12Key 14
Project 51612-Oct-2027-Jul-20780.214Key 15
Project 55012-Oct-2027-Jul-20780.6412.5Key 16
Project 5412-Oct-2027-Jul-20780.051Key 17
Project 51212-Oct-2027-Jul-20780.153Key 18
Project 5812-Oct-2027-Jul-20780.12Key 19
Project 545.512-Oct-2027-Jul-20780.5811.38Key 20
Project 5124.212-Oct-2027-Jul-20781.5931.05Key 21
Project 53912-Oct-2027-Jul-20780.59.75Key 22
Project 5812-Oct-2027-Jul-20780.12Key 23 
Project 53012-Oct-2027-Jul-20780.387.5Key 24
Project 534012-Oct-2027-Jul-20784.3685Key 25
Project 56812-Oct-2027-Jul-20780.8717Key 26
Project 54012-Oct-2027-Jul-20780.5110Key 27
Project 67.55-Jun-201-Jun-2051.57.5Key 28
Project 64.55-Jun-201-Jun-2050.94.5Key 29
Project 7417-Jul-2014-Jul-20414Key 30
Project 71017-Jul-2014-Jul-2042.510Key 31
Project 7617-Jul-2014-Jul-2041.56Key 32
Project 7517-Jul-2014-Jul-2041.255Key 33
Project 7217-Jul-2014-Jul-2040.52Key 34
Project 8101-Jul-221-Jul-207310.010.4Key 35
Project 90.530-Jun-2026-Jun-2050.10.5Key 36
Project 9130-Jun-2026-Jun-2050.21Key 37
Project 10230-Jul-2027-Jul-2040.52Key 38
Project 101031-Jul-208-Jul-20240.4210Key 39
Project 10319-Jun-208-Jun-20120.253Key 40

1 Reply