Forum Discussion

spandy34's avatar
spandy34
Responsive Resident
2 years ago
Solved

Date Table 12 week period

I have a Date Table which in the 12 Week Period Column creates a new period for every 12 weeks as per the column highlighted.  What the 12 Weeks Period is doing through is going back to 1 at the beginning of the new year so for Date 01 January 2024 the 12 Weeks Period has gone back to 1 but there are not 12 weeks in Period 5.  How do I get the column so it just rolls on without returning back to 1 for a new year?

 

danextian Anonymous Anonymous tamerj1 

  • spandy34's avatar
    spandy34
    2 years ago

    Hi - yes I did.  I created the following 12 Weeks Period column as suggested.

     

    12 Weeks Period = ROUNDUP(DIVIDE('Procurement_Planned_Visit_Date'[WeekNo]+1,12),0)
     
    The column included the WeekNo column.  The WeekNo was initially
    "WeekNo", WEEKNUM( [Date] ),
     
    But I changed the WeekNo column to the following and it has worked so I now get continuous week numbers
     
    "Week No", QUOTIENT( datediff(minx(_tab, [Date]),[date],day) ,7)
     
    So now the 12 Week Column covers multiple years if you look at the CalYear column below.
     

     

11 Replies

  • Are you taking the WeekNo from a different table, or is your Date table really called 'Procurement_Delivered_Visit_Date' ?

    • spandy34's avatar
      spandy34
      Responsive Resident

      The date table is called Procurement_Delivered_Visit_Date' and the WeekNo is the column next to the 12 Week Period column 

      • lbendlin's avatar
        lbendlin
        Super User

        Change your approach. Convert the Date into an integer, integer divide that by 7, then modulo that by 12 and add 1.