cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ezequiel Helper II
Helper II

Average hours per week

Hi

 

I'm trying to show the average hours per week per employee. The table contains Employee Name, hours, Project Name and week_number. One employee can have multiple projects in one week.

 

I tried the following:

 

Avg_hours = CALCULATE(AVERAGE(Tracker[Hours]), ALLEXCEPT(Tracker, Tracker[Employee_name)], Tracker[WeekNum]))
 
But this is returning the same number regardless the week selected. 
 
Am I doing something wrong?
 
Thanks,
 
Ezequiel

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Average hours per week

Hi,

Drag Employee Name and Start of week to the Table visual and write this measure

=AVERAGE(Tracker[Hours])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Super User III
Super User III

Re: Average hours per week

Hi @ezequiel ,

 

Can you share some more details on the information and data, share an example of the file and expected result?

 

I made a simple PBIX file and I'm getting changes on a card based on a slicer of the week but this can be different from your results.

 

Please see this post regarding How to Get Your Question Answered Quickly:

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490 (courtesy of @Greg_Deckler).

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Check out my blog: Power BI em Português


ezequiel Helper II
Helper II

Re: Average hours per week

Hi @MFelix 

 

As example an employee has this data

 

EmployeeNameHoursStart of WeekWeekNum
John77/29/20191
John77/29/20191
John78/5/20192
John78/5/20192
John218/5/20192
John28/12/20193
John58/12/20193
John48/12/20193
John28/12/20193
John88/12/20193
John98/12/20193
John28/12/20193
John88/12/20193

 

Using the formula  Avg_hours = CALCULATE(AVERAGE(Tracker[Hours]), ALLEXCEPT(Tracker, Tracker[EmployeeName], Tracker[WeekNum]))

 
The result I'm getting is 6.79 for the week of 7/29, 8/5, 8/12. The expected result would be
 
Week of 7/29: 7 hours
Week of 8/5: 11.67 hours
Week of 8/12: 5 hours
 
Thanks for the help
 
Ezequiel
Super User IV
Super User IV

Re: Average hours per week

Hi,

Drag Employee Name and Start of week to the Table visual and write this measure

=AVERAGE(Tracker[Hours])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors