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
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.
Highlighted
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
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 52 members 1,110 guests
Please welcome our newest community members: