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
ctedesco3307
Resolver II
Resolver II

Dynamic % of hours worked by Calendar measure

I need to report a % of billable hours worked by weeks, months, depending on how many hours the resource is available. Most people are hours  day but we have some part timers

 

In my Employee table I have the Hours per day they are expected to work

https://docs.google.com/spreadsheets/d/1WUMJc5DcaRbUhH08spNdVfFz8g4A5l7H1SvKsL1ITJs/edit#gid=0

 

In my worklogs table I have what they have entered as billable hours for each project they work on

https://docs.google.com/spreadsheets/d/1Uword5KlJ7WJJZPJ_agdodsViQbdkJAvEdSaF5fab_w/edit#gid=0

 

In my calendar table I have the date breakdowns

https://docs.google.com/spreadsheets/d/1Quq6mlax15D2KXwQpYQl0KzDlzlGYNXD/edit?usp=sharing&ouid=11101...

 

 The report time dimensions will change – day, week, month, etc so I need the calc to be dynamic

All help appreciated – thanks in advance

 

ctedesco3307_0-1637680926274.png

 

1 ACCEPTED SOLUTION

Hi @ctedesco3307 

 

Please try this solution.

1 Create a Measure to calculate workdays

Workdays =

CALCULATE (

    COUNT ( 'calendar'[WeekDay] ),

    ALLSELECTED ( 'calendar' ),

    FILTER ( 'calendar', 'calendar'[WeekDay] < 6 )

)

 

2 Create a Measure to calculate workhours

WorkHours =

SUMX (

    SUMMARIZE ( worklogs, worklogs[AUTHOR_NAME], worklogs[RelatedWrkHrs] ),

    worklogs[RelatedWrkHrs] * worklogs[Workdays]

)

 

3 Create Util Measure

Util =

DIVIDE ( SUM ( worklogs[BillHours] ), [WorkHours] )

 

Then, the result looks like this:

vcazhengmsft_0-1638266716513.png

 

Fore more details, please refer the attached pbix file.

 

Best Regards,

Community Support Team _ Caiyun

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it or I misunderstand your needs, please feel free to let us know. Thanks a lot!

View solution in original post

6 REPLIES 6
ctedesco3307
Resolver II
Resolver II

Thanks @v-cazheng-msft  - I'm assuming the 5 means the amount of of working days in the week? Is there a way to make that dynamic where The calculation can SUM the amout of working days in whatever time interval I am looking at? I want to work with a date heirarchy that will drill down from Year, Quarter, Month, Week, Day So for example in the snapshot you have below, anyone who is 40 hours a week with at WrkHours value of 8 in the Employee table shoould show 100% If they are 32 hours a week with a  WrkHours value of 6.5 in the Employee table they should still show 100% 

Hi @ctedesco3307 

 

Please try this solution.

1 Create a Measure to calculate workdays

Workdays =

CALCULATE (

    COUNT ( 'calendar'[WeekDay] ),

    ALLSELECTED ( 'calendar' ),

    FILTER ( 'calendar', 'calendar'[WeekDay] < 6 )

)

 

2 Create a Measure to calculate workhours

WorkHours =

SUMX (

    SUMMARIZE ( worklogs, worklogs[AUTHOR_NAME], worklogs[RelatedWrkHrs] ),

    worklogs[RelatedWrkHrs] * worklogs[Workdays]

)

 

3 Create Util Measure

Util =

DIVIDE ( SUM ( worklogs[BillHours] ), [WorkHours] )

 

Then, the result looks like this:

vcazhengmsft_0-1638266716513.png

 

Fore more details, please refer the attached pbix file.

 

Best Regards,

Community Support Team _ Caiyun

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it or I misunderstand your needs, please feel free to let us know. Thanks a lot!

@v-cazheng-msft  this worked Great!!! thank you - I made one minor adjustment to count the Working Days in the calendar table rather then the weekdays and it worked perfect!! thank you so much! 

v-cazheng-msft
Community Support
Community Support

Hi @ctedesco3307 

 

Do you want to display BillHours and Utill values of current month according to different weeks?

May I know how you create relationships for these three tables?

Could you please tell me how you create your Util Measure?

 

Best Regards,

Community Support Team _ Caiyun

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it or I misunderstand your needs, please feel free to let us know. Thanks a lot!

Hi @v-cazheng-msft 

Ultimately I'd like to display Bill Hours and util by the Date hierarchy, so starting from year, then drilling down to Quarters, Months, Weeks, Days. 

 

The table relationhips are

 

Employee.UserID = Worklogs.AUTHOR_ACCOUNT_ID
Calendar Table.date = Worklogs.WDate

 

The current calc I have for Util is 

Util = divide(Sum(Worklogs[BillHours]),40)  I'd like to replace the '40' - that represents the hours per week with a measure using the WrkHrs value from the employee table since not all emps work 40 hours a week and to make the measure dynamic. 
 
Please let me know if you need more intel.
 
Thank you 

 

Hi @ctedesco3307 

 

Thanks for your clearly description! I think I basically understand your needs. Please try this solution.

1 Create a Calculated column in worklogs table

RelatedWrkHrs = RELATED(Employee[WrkHrs])*5

 

2 Make some changes to your Util Measure

Util =

VAR MidT =

    SUMMARIZE(

        worklogs,

        worklogs[AUTHOR_NAME],

        "div", DIVIDE ( SUM ( worklogs[BillHours] ), SUM ( worklogs[RelatedWrkHrs] ) )

    )

RETURN

    SUMX (MidT, [div] )

 

Then, the result will look like this:

vcazhengmsft_1-1638167659318.png

 

For more details, please refer to the attached pbix file.

 

Best Regards,

Community Support Team _ Caiyun

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If you still have problems on it or I misunderstand your needs, please feel free to let us know. Thanks a lot!

 

 

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