How to nest Table.RenameColumns in Table.TransformColumns

Hi all,

Currently, in my code I have the below two steps. Can anyone please help me to merge these two lines of code in one ? I have been trying to do this for while now.

Thank you!

The code lines:
DateColumn = Table.TransformColumns(#“Converted to Table”, {{“Column1”,each _, type date}}),
#“Renamed Columns” = Table.RenameColumns(DateColumn,{{“Column1”, “Date”}})

Hi @Roboboboberts,

You can use below code to combine.

Instead of DateColumn in the last line you need to replace it with previous step expression.

#“Renamed Columns” = Table.RenameColumns( Table.TransformColumns(#“Converted to Table”, {{“Column1”,each _, type date}}),{{“Column1”, “Date”}})

But not sure it will convert to date type. You can use Table.TransformColumnTypes formula instead. Below FYR

#“Renamed Columns” = Table.RenameColumns( Table.TransformColumnTypes(#“Converted to Table”, {{“Column1”,type date}}),{{“Column1”, “Date”}})

3 Likes

Hi, thank you - the both suggestions worked perfectly.

Have a nice day!