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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rush
Helper V
Helper V

How to workout the Variance of Hours Captured & Available Hours?

I have 2 tables called V_TIMESHEET & Avail Hours

 

V_TIMESHEET contains the following columns:

 

  • StaffID (Numeric)
  • Year-Month (Text)
  • HoursCaptured (Numeric)

Avail Hours contains the following columns:

  • Year-Month (Text)
  • Available Hours (Numeric)

Avail Hours contains unqiue values of the Year-Month (16-03) in text while V_TIMESHEET has duplicates of Year-Month which they are joined on.

 

I am needing to work out the Sum of the HoursCaptured per StaffID per Year-Month then Subtract that from the Available Hours that was available for that Year-Month

 

Hours captured.PNGavail. hours.PNG

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee


@rush wrote:

I have 2 tables called V_TIMESHEET & Avail Hours

 

V_TIMESHEET contains the following columns:

 

  • StaffID (Numeric)
  • Year-Month (Text)
  • HoursCaptured (Numeric)

Avail Hours contains the following columns:

  • Year-Month (Text)
  • Available Hours (Numeric)

Avail Hours contains unqiue values of the Year-Month (16-03) in text while V_TIMESHEET has duplicates of Year-Month which they are joined on.

 

I am needing to work out the Sum of the HoursCaptured per StaffID per Year-Month then Subtract that from the Available Hours that was available for that Year-Month

 

Hours captured.PNGavail. hours.PNG


@rush

You can try to create proper relationship between those two tables and create a measure as below. Check more details in the attached zip file.

Capture.PNG

Measure = SUM(V_TIMESHEET[HoursCaptured])-SUM('Avail Hours'[Avaiable Hours])

Capture.PNG

View solution in original post

2 REPLIES 2
Eric_Zhang
Employee
Employee


@rush wrote:

I have 2 tables called V_TIMESHEET & Avail Hours

 

V_TIMESHEET contains the following columns:

 

  • StaffID (Numeric)
  • Year-Month (Text)
  • HoursCaptured (Numeric)

Avail Hours contains the following columns:

  • Year-Month (Text)
  • Available Hours (Numeric)

Avail Hours contains unqiue values of the Year-Month (16-03) in text while V_TIMESHEET has duplicates of Year-Month which they are joined on.

 

I am needing to work out the Sum of the HoursCaptured per StaffID per Year-Month then Subtract that from the Available Hours that was available for that Year-Month

 

Hours captured.PNGavail. hours.PNG


@rush

You can try to create proper relationship between those two tables and create a measure as below. Check more details in the attached zip file.

Capture.PNG

Measure = SUM(V_TIMESHEET[HoursCaptured])-SUM('Avail Hours'[Avaiable Hours])

Capture.PNG

@Eric_Zhang Thanks a lot.

 

It works well.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.