Forum Discussion

svishwanathan's avatar
svishwanathan
Helper III
8 years ago
Solved

Continous week number

Hello


I want to create a continous column of week numbers. By this, I mean say that last week in 2012 was 53, then in jan 2013, the weeknumber should be 54 and so on

 

 

Regards

  • Anonymous's avatar
    Anonymous
    8 years ago

    In Query Editor, try this.  Add a custom column, and paste in this formula:

     

    ([Year] - List.Min(<Enter Previous Step Name Here>[Year])) * 53 + [Week Number]

     

    This assumes 4 things.

    1) You have a column called [Year] (modify the name in the formula needed)

    2) You also have a column called [Week Number] (again, modify as needed)

    3) There are always 53 weeks per year

    4) [Week Number] is a column that always repeats from 1 to 53

     

    The new column will not "reset" at 53, but will continue to increase.

  • Anonymous's avatar
    Anonymous
    8 years ago

    Note, when you add the previous step name, it will need to follow this syntax:

     

    if the previous step name is 

     

    Changed Type

    then write this:

     

    #"Changed Type"

    Basically, wrap it in quotes and throw a # in front of it.

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    In Query Editor, try this.  Add a custom column, and paste in this formula:

     

    ([Year] - List.Min(<Enter Previous Step Name Here>[Year])) * 53 + [Week Number]

     

    This assumes 4 things.

    1) You have a column called [Year] (modify the name in the formula needed)

    2) You also have a column called [Week Number] (again, modify as needed)

    3) There are always 53 weeks per year

    4) [Week Number] is a column that always repeats from 1 to 53

     

    The new column will not "reset" at 53, but will continue to increase.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Note, when you add the previous step name, it will need to follow this syntax:

       

      if the previous step name is 

       

      Changed Type

      then write this:

       

      #"Changed Type"

      Basically, wrap it in quotes and throw a # in front of it.

    • Priyanshu208's avatar
      Priyanshu208
      New Member

      I am not able to understand what is "Enter Previous Step Name Here"

    • Anonymous's avatar
      Anonymous
      Not applicable

      Any idea to to get a contious week number taking the fact into account that there are years with 52 weeks?