2

Is there a way to use the sum window function to get the following results in green

enter image description here

I can get the total by using the following, but its givings a runnning total, I am looking for a group total

sum(groupvolume) OVER ( PARTITION BY geo_group  ORDER BY Month ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS group_volume
Mureinik
  • 297,002
  • 52
  • 306
  • 350
warrior_z
  • 23
  • 1
  • 5

1 Answers1

2

Just drop the rows between clause. By default, it will apply the function to all the rows within the partition. Note that without the rows clause, the order by clause is also meaningless:

SUM(groupvolume) OVER (PARTITION BY geo_group) AS group_volume
Mureinik
  • 297,002
  • 52
  • 306
  • 350