Forum Discussion
Changing Header Row Every Year
=Table.UnpiovtOtherColumns(PreviousStepName,{"Key"},"MonthYear","Value")
- Annu2847_A2 years agoNew 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_Wisco2 years agoHelper 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.
- wdx223_Daniel2 years agoCommunity Champion
=Table.Combine(Table.Group(PreviousStepName,"Column1",{"n",each Table.RenameColumns(Table.UnpivotOtherColumns(Table.PromoteHeaders(_),List.FirstN(Record.ToList(_{0}),2),"Date","Value"),{Record.ToList(_{0}){0},Table.ColumnNames(_){0}})})[n])