3 Replies Latest reply: Dec 9, 2011 4:21 PM by fixxer400 RSS

    how do I do a daily avg rollup"?



      Assume I have an array of values and each value has a corresponding date-timestamp(in a column called date_in).  the values are in a column called (raw_values)  all in the same table.  I wish to display in a period the last 4 Sundays averaged as one point, the last 4 Mondays averaged as one point.... and so on.  displaying that averaged "week" as a plot.  what type of sql call might be involved?





        • how do I do a daily avg rollup"?
          Rudolf Linder



          I donot know how to solve it with sql. But why not doing it using qlikview functionality?

          I would use a line chart with the dimension: "if (num(today()-num(date_in) < 27), weekday(date_in))"  -> only tale the last 28 days



          and the expression: avg(raw_value).

          Set Suppress When Value is Null and Sort by Weekday(date_in)


          And you see a wonderful linechart with the weekdays from Sunday to Saturday and the average of the 4 values of each weekday. You can use a variable instead of today() so you have a line chart depending from a selected date.

          Is that what you need?