Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Week Number Sequence

Hi,

 

I have different dates in my PowerBi and would like to assign the dates with Week 1, Week 2.

The dates go from 2019 to 2021, so I want them in a sequence - like after week 53, it should be week 54,55,56,...

The start date should be the first date as in the column, which I do not know too.

 

I need the dates with week numbers to be mentioned in sequential format.

Note : I am new to PowerBi too

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    try to add a custom column using this formula:

     

    e facce sapè

14 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable
    let
        Origine = List.Dates(#date(2019,1,1),365*3,#duration(1,0,0,0)),
        #"Conversione in tabella" = Table.FromList(Origine, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Modificato tipo" = Table.TransformColumnTypes(#"Conversione in tabella",{{"Column1", type date}}),
        #"Aggiunta colonna personalizzata" = Table.AddColumn(#"Modificato tipo", "wk", each if Date.Year([Column1])>2019 then +52*(Date.Year([Column1])-2019)+Date.WeekOfYear([Column1]) else Date.WeekOfYear([Column1]))
    in
        #"Aggiunta colonna personalizzata"
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    I couldnt understand what has been mentioned. Could you let me know the process, and should I enter this on editing the power query model.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I'm not sure I understand what your difficulties are. Try copying and pasting the script into the advanced editor and see if the resulting table is what you wanted. If not, explain better what you expect.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Shall I keep the column names as it is. What should I change if I put in the advanced editor

         

        I had pasted it and it shows me error - token error.