case when add_months ({fieldA}, months to add) &gt...
# general
k
case when add_months ({fieldA}, months to add) > {fieldB} then {fieldB} else add_months({fieldA},months to add) end
💯 2