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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
wvuthha
Frequent Visitor

Compare sum of hours from two tables and report the differences

Hi all,

 

I have two tables with working hours. One table has the working hours that employees have reported for their work (WORKREPORT). The second table has the real working time per day (ATTENDANCE).

I want to compare the sum per employee and day from the first and second table to show, where there is a difference in the cookings.

 

This is my first table:

wvuthha_0-1667216203170.pngSo Tom said, that he worked 5 hours for reporting and 4 hours for administrativ stuff on 9th of Sept. Jane said, she worked 7 hours for reporting on 18th of Sept. Etc.

 

This is my second table:

wvuthha_1-1667216361234.png

The timebookingsystem recorded, that Tom was 8,5 hours in the office on 20th of Sept. Jane was 7 hours in the office on 20th of Sept. Etc.

 

I now want to create a report that everybody see, if they have reported the right amount of hours.

For example: 

wvuthha_2-1667216515573.png

 

That means, Tom has reported 0,5 hours less than he was in the office on 20th of Sept. On the 21st of Oct, everything is fine, he reported 8 hours what is exactly his hours in the office.

Jane reported correct on 18th and 19th of Sept. But whe forgot the 20th of Sept, where she was in the office but did not report. 

 

I am not able to solve this, could anybody help me here?

 

BR
Tom

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Create a dimension table for the person like

Person dimension =
DISTINCT (
    UNION (
        ALLNOBLANKROW ( Attendance[Name] ),
        ALLNOBLANKROW ( 'Work table'[Name] )
    )
)

and link that to both tables. Create a proper date table, marked as a date table, and link that to both tables as well.

You can then create a measure like

Hours diff =
SUM ( Attendance[Hours] ) - SUM ( 'Work table'[hours] )

Set the filter to only show rows where the value is not 0. This should work at any level of the date hierarchy, e.g. week or month, as well as daily.

View solution in original post

4 REPLIES 4
wvuthha
Frequent Visitor

@johnt75 sorry, but now I have another new question around that......

I can now show the difference for every day, for every person. Is it possible in any way to show that aggregated for a month?

You could do an aggregate like

Aggregated diff =
SUMX ( 'person dimension', [hours diff] )
wvuthha
Frequent Visitor

Dear @johnt75 ,

 

Thank you so much for your help!

 

cu

Tom

johnt75
Super User
Super User

Create a dimension table for the person like

Person dimension =
DISTINCT (
    UNION (
        ALLNOBLANKROW ( Attendance[Name] ),
        ALLNOBLANKROW ( 'Work table'[Name] )
    )
)

and link that to both tables. Create a proper date table, marked as a date table, and link that to both tables as well.

You can then create a measure like

Hours diff =
SUM ( Attendance[Hours] ) - SUM ( 'Work table'[hours] )

Set the filter to only show rows where the value is not 0. This should work at any level of the date hierarchy, e.g. week or month, as well as daily.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors