Forum Discussion

Tinus1905's avatar
Tinus1905
Resolver I
2 years ago
Solved

Previous period

Hi,   In PowerBi query editor I want to have a column of the previous period.  The year periods are: Week 1-4 is period 1, week 5-8 is period 2 etc etc. If a year has 53 weeks then week 53 belongs...
  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    2 years ago

    In your Advanced Editor, Delete all other existing lines aftrer #"Added Custom3". Use these 3 lines after #"Added Custom3" step. 

     

        CurrentWeek = #"Added Custom3"[Period]{List.PositionOf(#"Added Custom3"[Current week], true)} - 1,
        #"Added Custom" = Table.AddColumn(#"Added Custom3", "Previous period", each [Period] = CurrentWeek)
    in
        #"Added Custom"