Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Average

Hi,

I am using a Window which keeps 5 rows with one field called 'Value".

Is there a way I can take the average of these five values and pass it to the next stream?

Regards,

Suresh

Former Member
Former Member replied

You can just aggregate by a dummy constant to group all the rows.  For example

CREATE INPUT WINDOW In1 SCHEMA (Value integer) PRIMARY KEY (Value) KEEP ALL;

CREATE OUTPUT WINDOW Avg

PRIMARY KEY DEDUCED

KEEP ALL

AS SELECT 1 DummyKey, avg(In1.Value) AvgVal FROM In1 GROUP BY 1;

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question