Vaibhav Najan
Vaibhav Najan

Reputation: 11

Contour Expression to achieve cumulative sum and partitioned sum from same expression

Cumulative sum and partitioned sum from same expression contour ? Can we achieve this ?

Tried to write this :

SUM("mass") OVER (PARTITION BY "class" ORDER BY "year" ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS "cumulative_sum", SUM("mass") OVER (PARTITION BY "class" ORDER BY "year" ASC ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) AS "partition_sum"

Two new columns one with cumulative sum and another with partitioned sum

Upvotes: 0

Views: 307

Answers (0)

Related Questions