在Power Query Editor中,我试图从Date列和Time列获取DateTime列。 问题是,当我尝试忽略“更改类型”步骤来使我的代码无效时,就无法正常工作。
这是可以正常工作的代码:
#"Added Custom1" = Table.AddColumn(#"Changed Type", "CreatedDate", each [Day]&"/"&[Month]&"/"&[Year], type date),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom1",{{"CreatedDate", type date}}),
#"Added Custom2" = Table.AddColumn(#"Changed Type1", "CreatedDateTime", each [CreatedDate]&[CreatedTime], type nullable datetime)
但是当我尝试省略#“ Changed Type1”步骤时(因为我的新列CreatedDate已经是日期类型)#“ Added Custom2”显示以下错误:
Expression.Error: We cannot apply operator & to types Text and Time.
Details:
Operator=&
Left=27/3/2018
Right=19:10:39
无效的代码:
#"Added Custom1" = Table.AddColumn(#"Changed Type", "CreatedDate", each [Day]&"/"&[Month]&"/"&[Year], type date),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "CreatedDateTime", each [CreatedDate]&[CreatedTime], type nullable datetime)
有人知道,如果我将新列定义为Date类型,为什么会有这个问题? 在第一个代码中(在#“ Changed Type1”步骤中),我将列类型从Date更改为Date。