Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am trying to get the average change of volume(Slope) for weeks in a region. Below is the sample data.
REGION | WeekEndingDate | Volume |
CENTRAL | 30/10/2015 | 7,542 |
CENTRAL | 06/11/2015 | 7,809 |
CENTRAL | 13/11/2015 | 7,527 |
CENTRAL | 20/11/2015 | 7,558 |
EAST | 30/10/2015 | 9,157 |
EAST | 06/11/2015 | 9,128 |
EAST | 13/11/2015 | 8,940 |
EAST | 20/11/2015 | 9,280 |
SOUTH | 30/10/2015 | 9,752 |
SOUTH | 06/11/2015 | 9,647 |
SOUTH | 13/11/2015 | 9,545 |
SOUTH | 20/11/2015 | 9,585 |
WEST | 30/10/2015 | 6,978 |
WEST | 06/11/2015 | 6,986 |
WEST | 13/11/2015 | 6,944 |
WEST | 20/11/2015 | 6,967 |
desired output should be Region, Avg Volume Change for 4Weeks.
Thanks in Advance,
Padmanabhan
Hi,
May be try this.. (Not sure, how did you get (-182) for Central ), for me i'm getting (-282)
=Sum(Aggr(Sum(Volume)-Above(sum(Volume)),REGION,WeekEndingDate))/(Count(Distinct WeekEndingDate)-1)
Edit
Try with Avg function
=Avg(Aggr(Sum(Volume)-Above(sum(Volume)),REGION,WeekEndingDate))
Hi,
I hope this is what you required,
Or else
Please mention the desired output.
PFA,
Regards,
HirisH
Hi,
You can refer the below Links:
10 Weeks and 39 Weeks rolling Moving Avg in Load Script
Calculating rolling n-period totals, averages or other aggregations
Hope this will be helpful.
Regards,
Bhavini Mehta.
If you want the linear correlation slope, make sure that the weeks are loading as dates, then in a table with Region as dimension, use the expression:
=Linest_m(Volume, WeekEndingDate) * 7
(multiply by 7 to convert from slope amount per day to amount per week)
Hi Hirish,
Thanks for your response, I am looking for avg change in the volume for each region over 4 weeks not avg volume.
Thanks,
Padmanabhan
Hi Jonathan,
I do not have data for the volume at each day(date), I have Volume only for Week Ending Date. So I cannot load Week as dates(day).
Thanks,
Padmanabhan
Hi,
Can you please post your desired output in excel. it can be helpful.
Expression:
=Aggr(Avg(Volume),REGION)
Hope this helps,
Regards,
Hirish
what is the expected output for above data?
You don't need daily data - that's not what I said. Make sure that the week field is a valid date field - like this:
LOAD Region,
WeekName(Date#(WeekEndingDate, 'dd/MM/yyyy')) As Week,
Volume,
...
Or
LOAD Region,
Date#(WeekEndingDate, 'dd/MM/yyyy') As WeekEndingDate,
Volume,
...
Hi All,
Please find my desired output below.
Central | ((267)+(-182)+31)/3=38 |
East | ((-29)+(-188)+340)/3=41 |