-2

I would like the average to be average excluding the current month counts.
I.e for November the average would calculated based on Jan-September values.

How do I do this using SQL Server 2008?

closed as unclear what you're asking by McNets, Max Vernon, Michael Green, Erik Darling, LowlyDBA Jan 22 at 21:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please update your question to include table definitions (DDL) and sample data in the form of insert statements. Also specify expected results. – Scott Hodgin Jan 22 at 19:13
1

Just add a predicate to filter out the current month's rows.

where yourDataColumn <  DATEADD(month, DATEDIFF(month, 0, getdate()), 0)

Not the answer you're looking for? Browse other questions tagged or ask your own question.