Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Annu2847_A
New Member

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 4
wdx223_Daniel
Super User
Super User

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

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.   

 

Annu2847_A_0-1707994029573.png

 

=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])

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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors