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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PMnooBI
Frequent Visitor

Resource hours per week

I have Project Online O data fed in Power BI.

I need to figure out how many hours a particular resource works in a week. I have the "work hours per day" for every task and for every resource. Also the task duration is determiined by start and end dates.

 

Now if I introduce a date slicer(from calendar table) and for example one of the tasks of a resource ends mid week, How do I calculate the work hours for the entire week?

Example: slicer set between 27th march and 1st April

I want to be able to add work hour everyday for the set date range. one task might end on 29th. so I should not add the work hour for that task for the rest of the days as well

 

 

 

 

1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @PMnooBI ,

Have a try.

 

Measure =
VAR _1 =
    MAXX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
VAR _2 =
    MINX ( ALLSELECTED ( 'Table 2' ), 'Table 2'[Date] )
VAR _3 =
    MAX ( 'Table 2'[workday] )
VAR _maxdate =
    IF ( MAX ( 'Table'[end date] ) > _1, _1, MAX ( 'Table'[end date] ) )
VAR _midate =
    IF ( MAX ( 'Table'[start time] ) < _2, _2, MAX ( 'Table'[start time] ) )
RETURN
    DATEDIFF ( _midate, _maxdate, DAY )

vrongtiepmsft_0-1680145461265.png

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors