Home | Feedback | Login

Fiscal Year

This is a work around to get the Fiscal Year. There might be better solution with newer version of SQL server.

CASE WHEN MONTH(dbo.Invoice.invoice_date) > 6 
THEN YEAR(dbo.Invoice.invoice_date) + 1 
ELSE YEAR(dbo.Invoice.invoice_date) 
END as [Fiscal Year]
 
CASE DATEPART(month , dbo.Invoice.invoice_date) 
WHEN 1 THEN 7 WHEN 2 THEN 8 WHEN 3 THEN 9 
WHEN 4 THEN 10 WHEN 5 THEN 11 WHEN 6 THEN 12 
WHEN 7 THEN 1 WHEN 8 THEN 2 WHEN 9 THEN 3 
WHEN 10 THEN 4 WHEN 11 THEN 5 WHEN 12 THEN 6 
END as [Fiscal Month]