The Calendar1stqtr function refer to the current calendar year only. If you data is dated prior to this year you will get 0.
The select statement should possibly read
if month(inputdate) in [1,2,3] then 1 else
if month(inputdate) in [4,5,6] then 2 else
if month(inputdate) in [7,8,9] then 3...