March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I want to get the average of a series of averages, but can't figure it out. Here's my data:
The circled value of 132.05 is the average of the total transactions / total workers (2509 / 19 = 132.05). But instead I need the average of the Average/Day *daily* values. In other words, it should be 29.52. How would I go about getting that? Thanks.
(BTW, I realize 19 is listed as the total # of workers even though every day shows only 17. I suspect at this point that is because the workers each day are not always the same, and therefore the total distinct count of workers across the 5 days is actually 19.)
Solved! Go to Solution.
This is a great question - based on what you're saying you'll need to 1) figure out the average for each day and 2) then average those averages. In the future, it's helpful if you share your DAX in your question.
To do this you need to use the AVERAGEX function.
The AvergageX function should give you what you need, something like
AverageX(values(tablename[colname]),[Average/Day Measure])
The AvergageX function should give you what you need, something like
AverageX(values(tablename[colname]),[Average/Day Measure])
Thanks to both of you. Very helpful. The VALUES function was the key as I had already been trying the AVERAGEX function without success. I had seen (and probably even used) the Values function before, but haven't spent enough time getting familiar with all the DAX functions.
The average of averages is usually the wrong way to approach this sort of problem. I'd rather take [Transactions] / [Worker-Days] for the top level average.
Let's imagine the following sample data:
Day | Workers | Transactions | Average/Day
1 | 1 | 10 | 10
2 | 2 | 40 | 20
The average of averages is (10 + 20) / 2 = 15. Transactions / Worker-Days is (10+40) / 3 = 16.7. Here we have 3 workers. 2 of them are able to process 20 transactions/day. 1 of them is only able to do 10/day. The 10/day worker is the outlier here.
Imagine adding a third row:
Day | Workers | Transactions | Average/Day
1 | 1 | 10 | 10
2 | 2 | 40 | 20
3 | 5 | 105 | 21
Average of averages: (10 + 20 + 21) / 3 = 17
Transactions / worker-days: (10 + 40 + 105) / (1 + 2 + 5) = 19.4
Here, it's clear that the typical worker gets ~20 transactions / day, but the average of averages method understates average productivity by >10%.
Average of averages overstates the impact of outliers.
To get transactions over worker-days you can simply replace your [Average/Day] measure:
// DAX // Measure Worker-Days = COUNTROWS( SUMMARIZE( 'FactTransaction' ,'FactTransaction'[WorkerKey] ,'FactTransaction'[Date] ) ) Average/Day = DIVIDE( [Transactions], [Worker-Days] )
SUMMARIZE() groups by the fields named, navigating relationships from the base table identified in the first argument. Thus, it gives us a table made up of the unique combinations of workers and days. When a single day is in context (one of your detail rows from the sample in your original post), this will be the same as the distinct number of workers on that day. [Average/Day] is thus the same for the detail level.
At the total level, we use the appropriate numerator and denominator and get a much more accurate result.
This is a great question - based on what you're saying you'll need to 1) figure out the average for each day and 2) then average those averages. In the future, it's helpful if you share your DAX in your question.
To do this you need to use the AVERAGEX function.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
93 | |
87 | |
84 | |
77 | |
49 |
User | Count |
---|---|
163 | |
148 | |
103 | |
74 | |
55 |