• Use a ranking function.

    with C1 as (

    select *, row_number() over(partition by [year], [month] order by dt) as rnk

    from calendar

    -- exclude weekends and holidays

    -- where isweekend = 0 and isholiday = 0

    )

    select *

    from C1

    where rnk = 5;