Forum Discussion

nlaauw's avatar
nlaauw
Regular Visitor
5 years ago
Solved

Calendar dates aligning to weeks

Help! I have people attend training and need to analyse their attendance dates by date but also by term and week which align to school terms and weeks. The spreadsheet with the data only has the date...
  • v-kkf-msft's avatar
    5 years ago

    Hi nlaauw ,

     

    Please try the following formula:

     

    Table = 
    VAR StartDate =
        DATE ( 2021, 10, 4 )
    VAR EndDate =
        DATE ( 2021, 12, 17 )
    VAR S_WeekNum =
        WEEKNUM ( StartDate, 2 ) - 1
    VAR DateRange =
        FILTER (
            CALENDAR ( StartDate, EndDate ),
            NOT WEEKDAY ( [Date], 2 ) IN { 6, 7 }
        )
    RETURN
        ADDCOLUMNS (
            DateRange,
            "Week",
                "Week "
                    & WEEKNUM ( [Date], 2 ) - S_WeekNum,
            "Term", 4
        )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.