SELECT ((MonthNum + (12 - @fystart)) % 12 + 1) AS RealMonth ...
SET @RealMonth = (@MonthNum + @fystart - 1) % 12 >>CASE @RealMonth WHEN 0 THEN 12 ELSE RealMonth END >>