Skip to main content
cancel
Showing results for
Search instead for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Anonymous
Not applicable

Sum of Occupation Days per Resource in given Month

Dear Community,

I am struggling with a formula for the Occupation of Resources per Month.

My current formula:

Occupied Days WithIn Month =
VAR StartDate = VALUE( SELECTEDVALUE( 'Resource Assignments'[Start] ) )
VAR FinishDate = VALUE( SELECTEDVALUE( 'Resource Assignments'[Finish] ) )
VAR MinDateInContext = VALUE( MIN( 'Calendar'[Date] ) )
VAR MaxDateInContext = VALUE( MAX( 'Calendar'[Date] ) )

RETURN
IF( AND( StartDate < MinDateInContext, FinishDate > MinDateInContext ) ,
MIN( FinishDate, MaxDateInContext ) - MinDateInContext,
IF( AND( AND( StartDate > MinDateInContext, StartDate < MaxDateInContext ), FinishDate > MinDateInContext ),
MIN( FinishDate, MaxDateInContext ) - StartDate,
BLANK() ) )

This basically gives me the right thing, I only need to add something to finalize it. My Matrix visual looks like this:
*All numbers of days and dates are used as examples

Resource     - Jan 23 - Feb 23 - Mar 23
Resource A      5 days
Resource B                   10 days

Problem A) is this formula doesn't calculate the SUM of Occupation Days per Resource, so when a Resource works on task 1 for the first 5 days of January and also works on task 2 the last 5 days of January, the formula gives 5 Occupation days, but ofcourse I need 10.

Problem B) is that this formula doesn't work when a Resource works on task 1 the last 10 days of January until the 10th day of February. In this case the formula should give 10 Occupation days in Jan and also 10 in Feb (in the Matrix visual), but instead the formula gives the 10 of Jan and skips the 10 in Feb as a whole.

Hopefully you can grasp my situation here. If not clear, I will come back with a sample file.

All best,
Fabian
2 REPLIES 2
Community Support

Hi @Anonymous ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

Thanks for your efforts & time in advance.

Best regards,
Community Support Team_ Binbin Yu

Anonymous
Not applicable

Hello,

I created this little sample table. My actual data is imported and synced to Project for the Web.

 Resource Start Finish Task Occupied Days Resource A 2/1/2023 13/1/23 Task A 10 Resource B 9/1/2023 3/2/2023 Task B 20 Resource A 23/1/23 27/1/23 Task C 5

What I need is a matrix view that looks like the following:

 Resource Jan'23 Feb'23 Mar'23 Resource A 15 Resource B 17 3

The value numbers represent the amount of days a resource is occupied in total (tasks combined), calculated per month.

In my formula mentioned in the first message it would give value 10 days in Jan 23 for Resource A, and not calculate the sum (=15). For Resource B it would give only the 17 in Jan 23 and does not calculate the days that are in the next month due to overlap.

Any ideas how to fix this?

Best,

Fabian

Helpful resources

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors