Forum Discussion

Mentok's avatar
Mentok
Regular Visitor
3 years ago
Solved

Repeating Roster Cycle

Hi all - looking for some assistance with what I assume is a fairly simple requirement that I just can't crack >.<  I have a generated date table in my data, and I need to add in a column denoting...
  • Anonymous's avatar
    Anonymous
    3 years ago

    HI Mentok,

    Here is the calculated table formula to generate a calendar table with date and 7-4 cycle number without any other additional columns.

     

    NewTable = 
    VAR _carlendar =
        CALENDAR ( DATE ( 2023, 1, 1 ), DATE ( 2030, 12, 31 ) )
    RETURN
        ADDCOLUMNS (
            _carlendar,
            "Cycle",
                MOD ( INT ( DATEDIFF ( MINX ( _carlendar, [Date] ), [Date], DAY ) / 7 ), 4 ) + 1
        )

     

    Regards,

    Xiaoxin Sheng