Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to get Current Quarter and Fiscal Quarter for a Date - Fiscal Year starts from 1st April

$
0
0

Hi, 

I need to calculate current quarter and fiscal quarter in my Sql query.

I have a column for DateTime Datatype. 

I need to find out Current Quarter Name like Q12012, Q22012, Q32012, Q42012 and Fiscal Quarter Name as well.

Now Fiacal Year starts from 1st April, and Current Quarter starts from 1st Jan.

For Current Quarter of 2012

  • Jan-Mar = Q12012
  • Apr-Jun = Q22012
  • Jul-Sep = Q32012
  • Oct-Dec = Q42012

For Fiscal Quarter of 2012 ( starts from 1st Apr, 2011 )

  • Apr2011-Jun2011 = Q12012
  • Jul2011-Sep2011 = Q22012
  • Oct2011-Dec2011 = Q32012
  • Jan2011-Mar2012 = Q42012

means if its 1st April, 2012,

  • its a new Fiacal Year 2013 so Fiacal Quarter Name should be Q12013
  • and its Current Quarter Name should be Q22012

Can you help me to calculate this in a select query for given dates?

Thanks in advance, 


Nirav


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>