Forum Discussion

Chanleakna123's avatar
Chanleakna123
Post Prodigy
5 years ago
Solved

Custom Column on Week

hi all ,  can anyone help me with the code ? in Year 2021 is the different between the Past Year.  as i calculate Week Number I used the Code : if Date.WeekOfYear([Date],6)>52 then 52 else Date.W...
  • AlB's avatar
    5 years ago

    Chanleakna123 

    Update it as follows:

    #"Added Custom1" = Table.AddColumn(#"Sorted Rows", "Week Number", each if Date.WeekOfYear([Date],6)>52 then 52
    else if ([Year]=2021 and List.Contains({1,2}, Date.WeekOfYear([Date],6))) then 1
    esle if [Year]=2021 then (Date.WeekOfYear([Date],6)-1) else Date.WeekOfYear([Date],6))

    Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.

    Cheers