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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Babakhsn
Frequent Visitor

Calculating Summation of a Column over a Period of Time

Hello everyone.

I have a "Resource Assignment" table. This table is based on the resources and tasks. So for each resource and task, we have a unique row. Here is a picture:

Screenshot 2023-09-21 105430.png

Each project has some tasks and for each task we have some resources allocated to that task.

Now in this table I have a DAX calculated column, that computes the average daily work for each resource and for each task.

For example, if the effort for completing a task is 20 hours and we have 4 days to complete it, then the average hourly work is 5 hours per day.
This is the code:

 

 

Average Hours per Task = 
DIVIDE(
'Resource Assignment'[Effort], 
DATEDIFF('Resource Assignment'[Start], 'Resource Assignment'[Finish], DAY),
0
)

 

 

 Now I want a table like this:
Screenshot 2023-09-21 104651.png

But instead of availability, I want to calculate sum of average hours per day.

This is the logic: imagine for the same period of 4 days, there is another task allocated to the same resource with effort of 20 hours. It means the average of 5 hours a day. Now in total for the 4 days, the resource has to work 10 hours per day to finish both tasks, but the maximum hours that a resource can work on a day is 8 hours a day. so this way the customer can see they are allocating this resource more than the max hours per day and they can know they are doing something wrong.

I want the customer to filter based on dates, so they would for example use a slicer and then this table would shrink to those dates and then I check in the Resource Assignment table, see if the finish and start dates of resources fit in the slicer dates and filter based on the resources and sum over all the averages to get a total average for each resource based on different tasks they are involved with.

Sorry it was long.

I'm fairly new to DAX an I don't exactly know how to implement this.

Thanks in advance.

1 REPLY 1
lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors