Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how do I do a daily avg rollup"?

Guys

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?

thanks

Marshall-fixxer400

ORBITZ

3 Replies
Anonymous
Not applicable
Author

Hi,

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?

Regards

Not applicable
Author

I did not think there was an sql alone call to handle the problem.  let me give your idea a try, sounds like it is right up my alley.

I will let you know

thanks

fixxer400

Not applicable
Author

Hey there,

I must have messed something up.  It only shows Monday on the xaxis.  Any thoughts? You are definitly on the right track.

thanks

Fixxer400

Orbitz