Hi All,
I am looking for 'n' row average (in the attached example, n == 3) based on other coulmn (-- "Customer_ID"). If my row number for each group (customer) is integer multiplier of 'n' i.e. [Row == Integer Constant x n]. My basic formula works fine. But if Row != Integer Constant x n, it takes remaining rows from other group. Which is giving me wrong results.
What I want -
Best Case - Calculate 'n' row average on sort of subset of the data based on Cutomer_ID and for the last remaining rows put the average value from previous averaged value.
Otherwise - leave the empty values as it is.
I tried to put :Customer_ID != Lag(:Customer_ID, -2) but it did not work for me. I can split the table on Customer_ID and then do the calculation but - there are more than 5000 ID and around 20 columns for average to be done. It doesn't seems the best idea !
Any help please ?
Thanks.
