Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
warfollowmy_ver
Creator III
Creator III

Loop, how? Need only in script: average for all dates less current

Need help!

Need only in script: average for all dates less current. Example in excel.

Please help! It is necessary only in the script!

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Table:

LOAD * INLINE [

    Date, sub1, sub2, SUM

    1/1/2016, 1, 1, 1

    1/2/2016, 1, 1, 2

    1/3/2016, 1, 2, 3

    1/4/2016, 2, 2, 4

    1/5/2016, 2, 3, 5

    1/6/2016, 2, 3, 6

    1/7/2016, 3, 4, 7

    1/8/2016, 3, 4, 8

    1/9/2016, 3, 5, 9

    1/10/2016, 3, 5, 10

];

FinalTable:

LOAD Date,

  sub1,

  sub2,

  SUM,

  Temp1,

  Temp2,

  Temp1/Temp2 as [Avg Group by Date];

LOAD *,

  RangeSum(Peek('Temp1'), SUM) as Temp1,

  RangeSum(Peek('Temp2'), 1) as Temp2

Resident Table

Order By Date;

DROP Table Table;


Capture.PNG

View solution in original post

2 Replies
sunny_talwar

May be this:

Table:

LOAD * INLINE [

    Date, sub1, sub2, SUM

    1/1/2016, 1, 1, 1

    1/2/2016, 1, 1, 2

    1/3/2016, 1, 2, 3

    1/4/2016, 2, 2, 4

    1/5/2016, 2, 3, 5

    1/6/2016, 2, 3, 6

    1/7/2016, 3, 4, 7

    1/8/2016, 3, 4, 8

    1/9/2016, 3, 5, 9

    1/10/2016, 3, 5, 10

];

FinalTable:

LOAD Date,

  sub1,

  sub2,

  SUM,

  Temp1,

  Temp2,

  Temp1/Temp2 as [Avg Group by Date];

LOAD *,

  RangeSum(Peek('Temp1'), SUM) as Temp1,

  RangeSum(Peek('Temp2'), 1) as Temp2

Resident Table

Order By Date;

DROP Table Table;


Capture.PNG

warfollowmy_ver
Creator III
Creator III
Author

Thank you so much!