Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

limiting data in sum() over partition by

$
0
0

limiting data in sum() over partition by

SELECT 
atttibute1,
attribute2,
attribute3,
month,
year
sum( rate) as Measure1,
sum(rate) over ( partition by
atttibute1,
attribute2,
attribute3,
month,
year
where year between ('2010-01-1' and '2010-01-05')
) as Measure_ytd
from Table1
group by (atttibute1,
attribute2,
attribute3,
month,
year)

Note :I want to have a measure which show data year wise 

lIKE PTD and YTD


Can we limit data in in sum() Over( partion by ) like the one above ?

If not what will be alternate to this


Mudassar



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>