cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
F-Wil
Frequent Visitor

Replace of column names

Hallo,

ich want to rename the colums names in     #"Geänderter Typ1" 

with the colum names of Table "z_dim_Messpunkte_SAP_namen":

This is my code:

 

let

    Quelle = Sql.Databases("idtsv069"),

    DB_QS = Quelle{[Name="DB_QS"]}[Data],

    dbo_v_SAP_ZDIM_MESSPUNKTE = DB_QS{[Schema="dbo",Item="v_SAP_ZDIM_MESSPUNKTE"]}[Data],

   #"Geänderter Typ" = Table.TransformColumnTypes(dbo_v_SAP_ZDIM_MESSPUNKTE,{{"MANDT", Int64.Type}}),

    #"Geänderter Typ1" = Table.TransformColumnTypes(#"Geänderter Typ",{{"MANDT", type text}}),

    #"Rename Columns" =  Table.RenameColumns(#"Geänderter Typ1", List.Zip( { Table.ColumnNames(#"Geänderter Typ1"), Table.ColumnNames(z_dim_Messpunkte_SAP_namen) } ) )

in

    #"Rename Columns"

 

I get the error:

 

FWil_0-1655652881987.png

A "RenameOperatios" is expected. What does that mean?

 

Where is the error?

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use this

1. if no. of columns a are more in 2nd table

 

#"Rename Columns" = Table.RenameColumns(#"Geänderter Typ1",List.Zip({Table.ColumnNames(#"Geänderter Typ1"),List.Range(Table.ColumnNames(z_dim_Messpunkte_SAP_namen),0,List.Count(Table.ColumnNames(#"Geänderter Typ1")))}))

2. If no. of columns are more in first table

#"Rename Columns" = Table.RenameColumns(#"Geänderter Typ1",List.Zip({List.Range(Table.ColumnNames(#"Geänderter Typ1"),0,List.Count(Table.ColumnNames(z_dim_Messpunkte_SAP_namen))),Table.ColumnNames(z_dim_Messpunkte_SAP_namen)}))

 

View solution in original post

1 REPLY 1
Vijay_A_Verma
Super User
Super User

Use this

1. if no. of columns a are more in 2nd table

 

#"Rename Columns" = Table.RenameColumns(#"Geänderter Typ1",List.Zip({Table.ColumnNames(#"Geänderter Typ1"),List.Range(Table.ColumnNames(z_dim_Messpunkte_SAP_namen),0,List.Count(Table.ColumnNames(#"Geänderter Typ1")))}))

2. If no. of columns are more in first table

#"Rename Columns" = Table.RenameColumns(#"Geänderter Typ1",List.Zip({List.Range(Table.ColumnNames(#"Geänderter Typ1"),0,List.Count(Table.ColumnNames(z_dim_Messpunkte_SAP_namen))),Table.ColumnNames(z_dim_Messpunkte_SAP_namen)}))

 

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors