Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
I have the following puzzle that I am trying to resolve and so far I was not able to find a good solution to it (DAX).
The raw data table looks like:
| Name | Activities | Date |
| John | 2 | 2019-07-07 |
| John | 3 | 2019-07-08 |
| John | 4 | 2019-07-12 |
| Deanna | 3 | 2019-07-08 |
| Deanna | 4 | 2019-07-09 |
| Deanna | 5 | 2019-07-11 |
I want to know the Average activities per day per "employee" so I have created two measures:
1- Worked days = DISTINCTCOUNT(Date)
2- Total Activities = SUM(Activities)
3- Avg Activities = Total Activities / Worked Days / DISTINCTCOUNT(Name)
Which yield the expected results:
| Name | Avg Activities | Total Activities | Worked days |
| John | 3 | 9 | 3 |
| Deanna | 4 | 12 | 3 |
So far so good, now I want to calculate the Average activities per day per name of the team, you would say that the above is pretty simple, just remove the Name component and I should get the team average:
| Avg Activities | Total Activities | Worked days | DISTINCTCOUNT(Name) |
| 2.1 | 21 | 5 | 2 |
As you can see the average result of 4.2 is not the right one, it should be 3.5 (in this case I've simulated the data to be simple at the eye).
This result is given by the way that Worked days counts the number of "active days" of each employee.
I think that a weighted average would work, but I have not been able to identify the right way to do it in PowerBI
Solved! Go to Solution.
hi, @Anonymous
This looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
For your case, just try this formula:
Measure = var _table=SUMMARIZE(Table1,Table1[Name],"Avg Activities",[Avg Activities]) return AVERAGEX(_table,[Avg Activities])
Result:
Best Regards,
Lin
hi, @Anonymous
This looks like a measure totals problem. Very common. See this post about it
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
For your case, just try this formula:
Measure = var _table=SUMMARIZE(Table1,Table1[Name],"Avg Activities",[Avg Activities]) return AVERAGEX(_table,[Avg Activities])
Result:
Best Regards,
Lin
Thank you!.
I've just combined your answer with an additional mesasure using HASONEFILETER to come out with a final table:
Now both totals and Team average show the right numbers.
Shouldn't your measures be :
worked days = COUNT(Table1[Date]) Avg Activities = [Total Activities] / [worked days]
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |