cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MohanV Established Member
Established Member

Need help to calculate Average

I am trying to calculate the average of each employees time spend hours.

Sample data:-

 

Emp IDbegin_dateSpendHrs
1234/2/2018 0:008.28
1234/3/2018 0:009.55
1234/4/2018 0:008.19
1234/5/2018 0:008.44
1234/6/2018 0:0010.09
1234/9/2018 0:009.58
1234/10/2018 0:009.41
1234/11/2018 0:008.47
1234/12/2018 0:0010.38
1234/13/2018 0:0010.01
1234/14/2018 0:001.41
1234/16/2018 0:0010.01
1234/17/2018 0:009.01

 

Im using begin date as a slicer to change the date range.

Capture.JPG

 

In above image 8.68 is the overall average for that perticular emp id for that perticular date range.

now as date range changes the average also changes.

 

Now i would like to write a measure or calculated column which will give me the overall average for that percticular date range.

 

expected output:-

 

Emp IDbegin_dateSpendHrsAvg
1234/2/2018 0:008.288.68
1234/3/2018 0:009.558.68
1234/4/2018 0:008.198.68
1234/5/2018 0:008.448.68
1234/6/2018 0:0010.098.68
1234/9/2018 0:009.588.68
1234/10/2018 0:009.418.68
1234/11/2018 0:008.478.68
1234/12/2018 0:0010.388.68
1234/13/2018 0:0010.018.68
1234/14/2018 0:001.418.68
1234/16/2018 0:0010.018.68
1234/17/2018 0:009.018.68
  Avg = 8.68

 

How can i get this done.

 

Please help me.

 

thanks,

Mohan V

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-yuezhe-msft
Moderator

Re: Need help to calculate Average

@MohanV,

Create a measure instead of calculated column.

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Need help to calculate Average

I’m. It 100% clear what you want, but it sounds like you want this

 

=calculate(average(table[hours]),All(table[date]))

 

Or possibly 

 

=calculate(average(table[hours]),Allselected(table[date]))

 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
MohanV Established Member
Established Member

Re: Need help to calculate Average

@MattAllington thanks for the reply

 

i tried what you have suggested.

 

i have written calculated column for the both functions.

below are the outputs that  i have got.

 

_Avg = calculate(average('table'[SpendHrs]),ALLSELECTED('table'[begin_date]))

Capture.JPG

 

_Avgcolumn = calculate(average('Table'[SpendHrs]),ALL('Table'[begin_date]))

 Page1.JPG

 

Please help me.

Moderator v-yuezhe-msft
Moderator

Re: Need help to calculate Average

@MohanV,

Create a measure instead of calculated column.

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 328 members 3,347 guests
Please welcome our newest community members: