I have an SSRS (SQL Server 2008 R2) report that shows aggregated information about items that meet a certain criteria at a specific point in time based on a reportDate
parameter. This report is used to calculate month-end values.
I need to extend the report to show a comparison against previous (or subsequent) months based on a numberOfMonths
parameter. For example with reportDate=2015-01-01
and numberOfMonths=4
I would expect to get a report with that compares the results of Jan 1st, Feb 1st, Mar 1st and Apr 1st.
I don't think I can use a range b/c some items that meet the criteria during parts of that range may not meet it at the month-end date.
The best analogy I can think of is an AR report where you would sum the outstanding invoices at the end of the month grouped by customer. An invoice created during a month but paid before the end of the month would not show up anywhere, but an invoice created Jan 15th and paid on Mar 15th would be included in the sum for the Feb 1st and Mar 1st columns.
What's the best way to accomplish this in SSRS?