Forum Discussion

Annu2847_A's avatar
Annu2847_A
New Member
2 years ago

Changing Header Row Every Year

Each Year will get a new File with the New Year-Month as a header Row.   

How to Unpivot the data. 

Sample Data :  

KeyJan-23Feb-23Mar-23Apr-23
AA14544667778
AA254123754557
AA3656456656656
AA43424565755
AA52342342354
AA65612354454
AA77875464123123
AA82345756679

 

KeyJan-24Feb-24Mar-24Apr-24
AA15443545778
AA2545634233
AA36556656656
AA4347237776
AA52342563454
AA667354454
AA7787454543443
AA8234575634

4 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    =Table.UnpiovtOtherColumns(PreviousStepName,{"Key"},"MonthYear","Value")

    • Annu2847_A's avatar
      Annu2847_A
      New Member

      Thanks wdx223_Daniel / for the Response.   

      The Above I have already tried but,  But I feel this doesn't work when another file comes in into  same dataset.  for another Year.  

      If you see below i have exported 2 year of Data,  but even if i will make first row as header , In the Header Row will have year 2023,  But same will get unpivoted.   Even Year 2024 Data will get unpivoted with 2023 only.  

      That's where i am facing the issue. in the same dataset every year , i have add the files, But Header Row has to be changed every year.   

       

       

      • JP_Wisco's avatar
        JP_Wisco
        Helper I

        It looks like you are combining files from multiple years. You will want to apply the unpivot recommended by wdx223_Daniel to your sample transformation query. You can then hop back into your main query after the files are combined and repivot or transform however you need.