Calculating what pay period it is

  • I have a query (attached) that is going to be used to generate a date dimension.

    One requirement is that there is a column that states which pay period it is (1, 2, 3, etc...).

    I am trying to get the query to increment the number when the "LastDayOfExemptPayPeriod" date changes. 

    I tried some window functions with no luck...can someone please help me out?

    Thanks!
    Michael

  • All that LastDayOfExemptPayPeriod column seems to calculate is the last day of the month so it'll change every day on the first of the month.  In which case wouldn't that calculation just be the number of months that have passed since the start date in the table?

    So just DATEDIFF(month, @StartDate, d) no need for anything fancy?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply