Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Fiscal Year YTD and previous YTD
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

United Kingdom
11 Posts

Posted - 04/03/2016 :  07:14:25  Show Profile  Reply with Quote
Hi All,

Morning. I need help resolving this SQL problem. All I want is able to get YTD total , running total of the current financial year compare to the previous financial year. the fiscal period begins in April to march of every year. I have tried but not able to get what I want. I would be happy if someone can assist.


Declare @PrevfinYear varchar(25)
set @PrevfinYear = '2014/15'

Declare @CurrentfinYear varchar(25)
set @CurrentfinYear = '2015/16'

----Fiscal year start on the 01/04/2014 to 31/03/2015 respectively

SELECT FinanacialYear, [Year],
Admission_date, Practice_Code, locality,
SUM(value) AS Current_FinancialYear_Total,
sum(YTD_Total) as TD_Total,
cast(0 as float) as Current_FinancialYear_Running_Total,
cast(0 as int) as previous_FinanacialYearTotal,
cast(0 as float) as Previous_FinancialYearRunningtotal,

FROM dbo.table_base

Group by FinanacialYear, [Year],
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000