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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
metcala
Helper III
Helper III

Expected hours per day

Hi

 

I am currently looking to write a DAX measure that looks at the expected hours per day vs recorded hours.

 

Data structure

 

Date

Date table

 

Resource

IDNameRoleStart DateEnd DateFTE
      

 

Time Record

IDNameDateActivityHours
     

 

Names

Bridging table

 

 

Relationships

Date table is linked to Resource on start date and end date with inactive relationships

Date table linked to Time Record on date with active relationship

Time Record linked to Names with active relationship

Resource linked to Names with active relationship

 

 

Expected Outcome

 

 1/5/241/5/24

1/5/24

2/5/24

2/5/24

2/5/24

....

NameExpectedActualDifferenceExpectedActualDifference 
        

 

Expected hours is 8 hours * FTE but only applies to week days which I wasn't sure how to approach.

 

This is the measure I've written so far for Expected Hours but it isn't quite working and isn't accounting for week days. Not quite sure where to start with the difference yet either.

 

Expected Hours =
SUMX(
VALUES('Resource'[Name]),
CALCULATE(
SUMX('Resource',
IF('Resource'[Start Date]<=TODAY() && ISBLANK('Resource'[End Date] && 'Resource'[Start Date]<MAX('Date'[Date]),
'Resource'[FTE]*8,
IF(IF('Resource'[Start Date]<=TODAY() && 'Resource'[End Date]>TODAY() && 'Resource'[Start Date]<MAX('Date'[Date]),
'Resource'[FTE]*8,
0)
)
)
)
)

Any help would be very much appreciated! 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@lbendlin , thanks for your concern about this case, I have an addition to make to the content.

Hi  @metcala ,

 

If by weekdays you mean Monday to Friday, you can add the following filter to the formula:

NOT(WEEKDAY(MAX('Table'[Date]),2)) in {6,7}

If by weekdays you mean not only Monday to Friday but also the rest of the holidays, you can first use Enter data to create a table to collect the holiday information and add the following filter to the formula:

vyangliumsft_0-1717486479337.png

NOT(WEEKDAY(MAX('Table'[Date]),2)) in {6,7} && NOT(MAX('Table'[Date])) in SELECTCOLUMNS('Holidays_Table',"date",[Holidays])

If it doesn't meet your expectations, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@lbendlin , thanks for your concern about this case, I have an addition to make to the content.

Hi  @metcala ,

 

If by weekdays you mean Monday to Friday, you can add the following filter to the formula:

NOT(WEEKDAY(MAX('Table'[Date]),2)) in {6,7}

If by weekdays you mean not only Monday to Friday but also the rest of the holidays, you can first use Enter data to create a table to collect the holiday information and add the following filter to the formula:

vyangliumsft_0-1717486479337.png

NOT(WEEKDAY(MAX('Table'[Date]),2)) in {6,7} && NOT(MAX('Table'[Date])) in SELECTCOLUMNS('Holidays_Table',"date",[Holidays])

If it doesn't meet your expectations, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Liu Yang

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

lbendlin
Super User
Super User

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to 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.

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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