Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Experts,
I have a question regarding running average. I have a table with Fees by OrderNum and OrderDate.
In the report, I want to see the data by Order Day (1, 2, etc.) and Avg fees and running average.
As you can see in the example below, I have 3 orders for 14th and average for this day 48.33 (45, 45 and 50). But Average of all orders from 10th to 14th is 46.25 but my running avg column shows (table 2 below) 45.83
How can I get the running average to calculate the average for individual orders till that day instead of taking average of "average fees by day"? How do I get 46.25 in the running average for 14th instead of 45.83? Any help you can provide to fix the expression for Running average would be greatly appreciated.
In my actual report, the date range is flexible, so it is not MTD or fixed range and we can have any number of days (1 to 31) in the list.
Data:
Order Day | OrderNum | MyTestFee |
| 10 | 9504820 | 45 |
| 11 | 9502894 | 45 |
| 11 | 9505264 | 45 |
| 13 | 9556549 | 45 |
| 13 | 9557471 | 45 |
| 14 | 9556755 | 45 |
| 14 | 9556967 | 45 |
| 14 | 9557448 | 55 |
Report:
| Order Day | Avg Fee | Running Avg |
| 10 | 45.00 | 45.00 |
| 11 | 45.00 | 45.00 |
| 13 | 45.00 | 45.00 |
| 14 | 48.33 | 45.83 |
| Total | 46.25 | - |
Thanks a lot in advance!
Archana.
added a new expression
= avg(aggr(avg(MyTestFee ),OrderDay))
Try with this expression
if(RowNo()=0,
RangeAvg(ABOVE(Avg(MyTestFee),0,Count(DISTINCT OrderDay))), RangeAvg(ABOVE(Avg(MyTestFee),0,RowNo())))
Hope it helps