Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
padmanabhan_ram
Creator II
Creator II

Avg for Weeks Volume change region wise

Hi All,

I am trying to get the average change of volume(Slope) for weeks in a region. Below is the sample data.

  

REGIONWeekEndingDate            Volume
CENTRAL30/10/20157,542
CENTRAL06/11/20157,809
CENTRAL13/11/20157,527
CENTRAL20/11/20157,558
EAST30/10/20159,157
EAST06/11/20159,128
EAST13/11/20158,940
EAST20/11/20159,280
SOUTH30/10/20159,752
SOUTH06/11/20159,647
SOUTH13/11/20159,545
SOUTH20/11/20159,585
WEST30/10/20156,978
WEST06/11/20156,986
WEST13/11/20156,944
WEST20/11/20156,967

desired output should be  Region, Avg Volume Change for 4Weeks.

Thanks in Advance,

Padmanabhan  

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

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)

Capture.JPG

Edit

Try with Avg function

=Avg(Aggr(Sum(Volume)-Above(sum(Volume)),REGION,WeekEndingDate))

View solution in original post

14 Replies
HirisH_V7
Master
Master

Hi,

I hope this is what you required,

Or else

Please mention the desired output.

avg Volume Change.PNG

PFA,

Regards,

HirisH

HirisH
“Aspire to Inspire before we Expire!”
Anonymous
Not applicable

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.

jonathandienst
Partner - Champion III
Partner - Champion III

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)


t1.png

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
padmanabhan_ram
Creator II
Creator II
Author

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

padmanabhan_ram
Creator II
Creator II
Author

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

HirisH_V7
Master
Master

Hi,

Can you please post your desired output in excel. it can be helpful.

Expression:

=Aggr(Avg(Volume),REGION)

Hope this helps,

Regards,

Hirish

HirisH
“Aspire to Inspire before we Expire!”
Kushal_Chawda

what is the expected output for above data?

jonathandienst
Partner - Champion III
Partner - Champion III

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,

          ...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
padmanabhan_ram
Creator II
Creator II
Author

Hi All,

Please find my desired output below.

 

Central((267)+(-182)+31)/3=38
East((-29)+(-188)+340)/3=41