June 18, 2015 at 12:39 pm
Hi everyone
I have the following query:
SELECT DATE, REGION, COUNT(*) as 'CountOf'
FROM MyTable
WHERE DATE BETWEEN @StartDate and @EndDate
GROUP BY DATE, REGION
This works ok in SSRS in a very basic matrix table showing the DATE as a column and the REGION as the row (sum of CountOf as the data). My problem is that I want to show the differences between each of the days in a column next to the DATE columns ie increase/decrease since previous day. I'm struggling to do this within the SSRS report itself and was wondering how I could achieve this in the SQL itself? I suppose I want to sum each DATE/REGION and calculate the difference from one day to the next.
Any help would be greatly received...
BO
June 18, 2015 at 1:08 pm
Maybe something like this, assuming you're using 2008.
http://www.rafael-salas.com/2008/05/t-sql-lead-and-lag-functions.html
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply