Can you explain a little more please what your expected output should be. Can you share some more data? You can give your Contract Year in your if like If(Type = 'A' and Year = '2016' , yourexpr) but i believe this is not what you are looking for, so need more information.