gazy007 (7/2/2015)
Thanks Luis, But I am not getting right numbers for 2015 and 2016 as we need to get for the whole year rather than getdate() or today. I hope I am making sense here.SUM(CASE WHEN YEAR(PeriodEnd) = YEAR(DATEADD(YY, 0,)))) THEN Value Else 0 End) as '2015'
SUM(CASE WHEN YEAR(PeriodEnd) = YEAR(DATEADD(YY, 1,)))) THEN Value Else 0 End) as '2016'
Thanks Luis.
Why do you believe that you're getting numbers for just one day?