I must have misunderstood AVERAGEX as the answer isn't the average of the rows that i think are being fed in?
where StoreDayQuarterID represents a unique identifier of each 15 minute slot for each store. ErcID is the identifier of the till in use. So the idea being to calculate in each 15 minute window how many different tills were used and then average the lot.
However if i build a pivot table with StoreDayQuarterID as the rows and Distinctcount of ErcID as the values and this measure also as a value I see this table(cant work out how to insert a table!)
[TABLE="width: 370"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]StoreDayQtrID[/TD]
[TD]Till usage per Qtr per store[/TD]
[TD]Distinct Count of EcrID[/TD]
[/TR]
[TR]
[TD]000642125.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642129.4375[/TD]
[TD] 2.00[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD]000642130.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642131.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642132.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642135.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642136.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642137.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642138.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642139.4375[/TD]
[TD] 2.00[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD]000642142.4375[/TD]
[TD] 2.00[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD]000642143.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642144.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642145.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642146.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642150.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642151.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642152.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642153.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD] 3.79[/TD]
[TD] 7[/TD]
[/TR]
</tbody>[/TABLE]
As you can see on each line the measure has correctly calculated the number of tills (column 2) . However the average of these rows is 3.58 NOT 3.79. What have I done wrong as cannot think of any way to get to 3.79.
Thanks for any advice
Mike
Code:
=AVERAGEX(Transactions, CALCULATE(
DISTINCTCOUNT(Transactions[EcrID]),
FILTER(
Transactions,
[StoreDayQuarterID]=EARLIER([StoreDayquarterID])
)
)
)
where StoreDayQuarterID represents a unique identifier of each 15 minute slot for each store. ErcID is the identifier of the till in use. So the idea being to calculate in each 15 minute window how many different tills were used and then average the lot.
However if i build a pivot table with StoreDayQuarterID as the rows and Distinctcount of ErcID as the values and this measure also as a value I see this table(cant work out how to insert a table!)
[TABLE="width: 370"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]StoreDayQtrID[/TD]
[TD]Till usage per Qtr per store[/TD]
[TD]Distinct Count of EcrID[/TD]
[/TR]
[TR]
[TD]000642125.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642129.4375[/TD]
[TD] 2.00[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD]000642130.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642131.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642132.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642135.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642136.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642137.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642138.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642139.4375[/TD]
[TD] 2.00[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD]000642142.4375[/TD]
[TD] 2.00[/TD]
[TD] 2.00[/TD]
[/TR]
[TR]
[TD]000642143.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642144.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642145.4375[/TD]
[TD] 4.00[/TD]
[TD] 4.00[/TD]
[/TR]
[TR]
[TD]000642146.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642150.4375[/TD]
[TD] 5.00[/TD]
[TD] 5.00[/TD]
[/TR]
[TR]
[TD]000642151.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642152.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]000642153.4375[/TD]
[TD] 3.00[/TD]
[TD] 3.00[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD] 3.79[/TD]
[TD] 7[/TD]
[/TR]
</tbody>[/TABLE]
As you can see on each line the measure has correctly calculated the number of tills (column 2) . However the average of these rows is 3.58 NOT 3.79. What have I done wrong as cannot think of any way to get to 3.79.
Thanks for any advice
Mike