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
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

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

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Top Kudoed Authors