Hi,
I'm trying to use an indicator to illustrate a trend in a Reporting Services report.
At the moment I have (for example) Month and AvgSales. For each month, I think I need to pull through last month's average sales in the next column - I can then use this to show my trend.
So, at the moment I have this:
This works and gives me the correct figures, but takes quite a while to run (1min+).
Is there any way I can make this more efficient, or am I barking up the wrong tree completely?
Edit: SQL Server 2008 R2 btw - I always forget that!
Cheers!
I'm trying to use an indicator to illustrate a trend in a Reporting Services report.
At the moment I have (for example) Month and AvgSales. For each month, I think I need to pull through last month's average sales in the next column - I can then use this to show my trend.
So, at the moment I have this:
Code:
WITH Sales AS (
SELECT Month
, AVG(SalesAmount) AS AvgSales
FROM tblSales)
SELECT ThisMonth.Month
, ThisMonth.AvgSales
, LastMonth.AvgSales
FROM Sales AS ThisMonth INNER JOIN
Sales AS LastMonth ON LastMonth.Month + 1 = ThisMonth.Month
This works and gives me the correct figures, but takes quite a while to run (1min+).
Is there any way I can make this more efficient, or am I barking up the wrong tree completely?
Edit: SQL Server 2008 R2 btw - I always forget that!
Cheers!
Last edited: