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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
suidino2
Frequent Visitor

Dataflow to lakehouse, bulk change header to appropriate format

In my scenario, many current data source table has space in the header name. I understand that when loading data to Lakehouse, table header can not have space in it. Is there a way to bulk fill the header space? Or any other function that can change header to appropriate format? 

1 ACCEPTED SOLUTION
miguel
Community Admin
Community Admin

Hi,

There's a couple of things that you can do to tackle this. 

 

The UI way

  • Reference your query twice miguel_6-1685163764002.png

     

  • In both references make sure to demote the headers miguel_0-1685163327601.png

     

  • Let's say that one of the referenced queries will be called "Headers" and the other one will be "Data"
    • For the Headers query:
      • Keep only the top 1 row miguel_1-1685163430190.png

         

      • Apply the "Replace values" transform to every single column in your query miguel_2-1685163500339.png
    • For the Data query:
      • Remove the top 1 row miguel_3-1685163582881.png

         

    • Append the Headers and Data query in that exact order miguel_4-1685163689308.png

       

    • Promote the first row to be the headers of the column miguel_5-1685163726980.png

       

    • Remove the now top 1 row of the table

miguel_8-1685163835803.png

 

The M script way requires you to first use Table.ColumnNames to get the list of columns of your table, then use a function like List.Transform to establish how you'd like to transform such list of columns and then the use those two pieces to pass the arguments required for the Table.RenameColumns function and perhaps using the List.Zip function to create that list of lists (of previous and new column names).

 

Let us know if this helps!

 

View solution in original post

1 REPLY 1
miguel
Community Admin
Community Admin

Hi,

There's a couple of things that you can do to tackle this. 

 

The UI way

  • Reference your query twice miguel_6-1685163764002.png

     

  • In both references make sure to demote the headers miguel_0-1685163327601.png

     

  • Let's say that one of the referenced queries will be called "Headers" and the other one will be "Data"
    • For the Headers query:
      • Keep only the top 1 row miguel_1-1685163430190.png

         

      • Apply the "Replace values" transform to every single column in your query miguel_2-1685163500339.png
    • For the Data query:
      • Remove the top 1 row miguel_3-1685163582881.png

         

    • Append the Headers and Data query in that exact order miguel_4-1685163689308.png

       

    • Promote the first row to be the headers of the column miguel_5-1685163726980.png

       

    • Remove the now top 1 row of the table

miguel_8-1685163835803.png

 

The M script way requires you to first use Table.ColumnNames to get the list of columns of your table, then use a function like List.Transform to establish how you'd like to transform such list of columns and then the use those two pieces to pass the arguments required for the Table.RenameColumns function and perhaps using the List.Zip function to create that list of lists (of previous and new column names).

 

Let us know if this helps!

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayFBCUpdateCarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.