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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
itsme
Resolver I
Resolver I

Sum Holiday Hours Only Once Per Person Per Day

I need sum the number of holiday hours for employees. Employees can work on multiple projects at one time, but they will only get paid for 8 holiday hours regardless of how many project they work on.

 

The data table below shows that John works on Project A and Project B at the same time and there's a holiday that overlaps both projects on 12/24/2021. If you summed all his holiday hours for the dates shown in the table, it would equal 24 hours. In reality, we are only paying him for 16 holiday hours.

 

DateNameProjectHoursHoliday
12/17/2021JohnA80
12/18/2021JohnA00
12/19/2021JohnA00
12/20/2021JohnA80
12/21/2021JohnA80
12/22/2021JohnB40
12/23/2021JohnB60
12/24/2021JohnB08
12/25/2021JohnB00
12/26/2021JohnB00
12/27/2021JohnB70
12/28/2021JohnB60
12/29/2021JohnB60
12/22/2021JohnA80
12/23/2021JohnA70
12/24/2021JohnA08
12/25/2021JohnA00
12/26/2021JohnA00
12/27/2021JohnA40
12/28/2021JohnA60
12/29/2021JohnA60
12/30/2021JohnA70
12/31/2021JohnA50
1/1/2022JohnA00
1/2/2022JohnA00
1/3/2022JohnA40
1/4/2022JohnA08
1/5/2022JohnA50
1/6/2022JohnA50

 

I need to create a measure that respects those rules and only sums once per distinct date and employee. Then I will put it into a table or chart that contains month and looks something like this:

 

MonthHoursHoliday
December '21968
January '22148
Total11016

 

I have a calendar table that connect to this data table. Both Hours and Holiday are in the same data table.

 

Please let me know if you have any thoughts. I'm guessing SUMX will be involved but not sure exactly how to structure this.

 

Thank you!!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @itsme 

Please try

Holiday Hours =
SUMX (
    SUMMARIZE (
        'Table',
        'Table'[Name],
        'Date'[Date],
        "@Hours", MAX ( 'Table'[Holiday] )
    ),
    [@Holiday]
)

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @itsme 

Please try

Holiday Hours =
SUMX (
    SUMMARIZE (
        'Table',
        'Table'[Name],
        'Date'[Date],
        "@Hours", MAX ( 'Table'[Holiday] )
    ),
    [@Holiday]
)

Thank you @tamerj1 ! I believe the last line should be [@Hours] instead of [@Holiday].

@itsme 

Yes that is correct 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.