• There's likely a much simpler solution, but it's Saturday morning and I'm not quite "clicking" 😉

    Try this:

    with TermCTE (Doc, ProdType, Term, TermType) as

    (Select

    Doc,

    ProdType,

    Term,

    TermType = case when Term = 1 then 'Yr'

    when Term = 12 then 'Mth'

    else 'Other'

    end

    from Table_name)

    , sumCTE (Doc, ProdType, Term, YrSum, MthSum)

    as

    (Select

    Doc,

    ProdType,

    Term,

    YrSum = (Select sum(Term) from TermCTE where TermType = 'Yr'),

    MthSum = (Select sum(Term) from TermCTE where TermType = 'Mth')

    from TermCTE)

    Select

    Doc,

    ProdType,

    Term,

    YrSum,

    MthSum,

    Sum_of_both = YrSum + MthSum

    from sumCTE