cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

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

@Anonymous,

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

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.
Anonymous
Not applicable

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

@Anonymous,

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
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors