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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Community Champion
Community Champion

=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
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.