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.
I am trying to calculate the average of each employees time spend hours.
Sample data:-
Emp ID | begin_date | SpendHrs |
123 | 4/2/2018 0:00 | 8.28 |
123 | 4/3/2018 0:00 | 9.55 |
123 | 4/4/2018 0:00 | 8.19 |
123 | 4/5/2018 0:00 | 8.44 |
123 | 4/6/2018 0:00 | 10.09 |
123 | 4/9/2018 0:00 | 9.58 |
123 | 4/10/2018 0:00 | 9.41 |
123 | 4/11/2018 0:00 | 8.47 |
123 | 4/12/2018 0:00 | 10.38 |
123 | 4/13/2018 0:00 | 10.01 |
123 | 4/14/2018 0:00 | 1.41 |
123 | 4/16/2018 0:00 | 10.01 |
123 | 4/17/2018 0:00 | 9.01 |
Im using begin date as a slicer to change the date range.
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 ID | begin_date | SpendHrs | Avg |
123 | 4/2/2018 0:00 | 8.28 | 8.68 |
123 | 4/3/2018 0:00 | 9.55 | 8.68 |
123 | 4/4/2018 0:00 | 8.19 | 8.68 |
123 | 4/5/2018 0:00 | 8.44 | 8.68 |
123 | 4/6/2018 0:00 | 10.09 | 8.68 |
123 | 4/9/2018 0:00 | 9.58 | 8.68 |
123 | 4/10/2018 0:00 | 9.41 | 8.68 |
123 | 4/11/2018 0:00 | 8.47 | 8.68 |
123 | 4/12/2018 0:00 | 10.38 | 8.68 |
123 | 4/13/2018 0:00 | 10.01 | 8.68 |
123 | 4/14/2018 0:00 | 1.41 | 8.68 |
123 | 4/16/2018 0:00 | 10.01 | 8.68 |
123 | 4/17/2018 0:00 | 9.01 | 8.68 |
Avg = 8.68 |
How can i get this done.
Please help me.
thanks,
Mohan V
Solved! Go to Solution.
@Anonymous,
Create a measure instead of calculated column.
Regards,
Lydia
@Anonymous,
Create a measure instead of calculated column.
Regards,
Lydia
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]))
@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]))
_Avgcolumn = calculate(average('Table'[SpendHrs]),ALL('Table'[begin_date]))
Please help me.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
96 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |