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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jerryr125
Helper III
Helper III

Creating a header from the first two rows

Hi - 

I know in Power Query you can "Use First Row as headers" function.

Is there a way to use the first two rows as headers  (combine both rows  to create one header row).

Example:

 

abcd
efgh
10203040
50607080
90100110120

 

Output:

 

aebfcgdh
10203040
50607080
90100110120

Any thoughts?

 

Thanks - jerryr

1 ACCEPTED SOLUTION
SundarRaj
Super User
Super User

Here's another solution you could refer to. Thanks

SundarRaj_0-1739558030686.png

 

Sundar Rajagopalan

View solution in original post

8 REPLIES 8
Qasim_Jan
Frequent Visitor

solution.png

Qasim_Jan
Frequent Visitor

solution.png

SundarRaj
Super User
Super User

Here's another solution you could refer to. Thanks

SundarRaj_0-1739558030686.png

 

Sundar Rajagopalan

Thank you very much

dufoq3
Super User
Super User

Hi @jerryr125, another solution:

 

Add this code as a new step, replace Source in code with your previous_step_name if necessary.

dufoq3_0-1739549333880.png

= Table.PromoteHeaders(Table.FromColumns(List.TransformMany(Table.ToColumns(Source),
        each {List.Skip(_, 2)},
        (x,y)=> {Text.Combine(List.FirstN(x, 2))} & y)))

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

slorin
Super User
Super User

Hi @jerryr125 

 

= Table.FromRows(
List.Skip(Table.ToRows(Source), 2),
List.Transform(
List.Zip({Record.ToList(Source{0}), Record.ToList(Source{1})}),
Text.Combine))

Stéphane

Fowmy
Super User
Super User

@jerryr125 
Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("JYu5DcBADMN2UX2FnT+zGC7yZ/8JIjkFCUKAIrChYScHOZEtcLFu8pC3FjdmJ/XSYLWO6kmapeVfV7VbuX7OY+YH", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t]),
    Custom1 = Table.FromRows({List.Transform(Table.ToColumns(Table.FirstN(Source,2)) , each Text.Combine(_) )}),
    Custom2 = Table.PromoteHeaders(Table.Combine( {Custom1 , Table.Skip(Source,2)} ))
in
    Custom2

 

Fowmy_0-1739529239496.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Akash_Varuna
Super User
Super User

Hi @jerryr125 , Could you please try this 

  • Promote the first row to headers: Use the "Use First Row as Headers" option.
  • Combine the first two rows:
    1. Select both rows.
    2. Use the "Transform" tab > "Merge Columns."
    3. Select desired delimiter.
      If this post helped please do give a kudos and accept this as a solution
      Thanks In Advance

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.