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
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
v-yuezhe-msft
Employee
Employee

@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
v-yuezhe-msft
Employee
Employee

@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.

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 an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

@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.

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.