Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Finding date using Weeknum Weekday and Year

Hi Team, I have weeknumber column WeekDay Colum and Year column, I have to find date for this. Can you please help me.   Thanks!
  • v-yanjiang-msft's avatar
    3 years ago

    Hi Anonymous ,

    According to your description, here's my solution, create a column.

    Column =
    VAR _firstweek =
        7 - WEEKDAY ( DATE ( [Year], 1, 1 ) ) + 1
    VAR _between = ( [Week] - 1 ) * 7
    VAR _lastweek =
        SWITCH (
            [WeekDay],
            "Monday", 1,
            "Tuesday", 2,
            "Wedsday", 3,
            "Thursday", 4,
            "Friday", 5,
            "Saturday", 6,
            "Sunday", 7
        )
    RETURN
        DATE ( [Year], 1, 1 ) + _firstweek + _between + _lastweek
    

    Get the correct result:

    I attach my sample below for your reference.

     

    Best regards,

    Community Support Team_yanjiang

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