Azure 数据流字符串到日期的格式转换

问题描述

我的来源是 CSV 包含结束日期和开始日期列数据类型字符串。我需要以目标表格式更改这些日期列。

来源 -

enter image description here

目的地:

SALES_ORGANIZATION  STARTDATE   ENDDATE EXTRACT_MNTS
AE93-AE-CS  2020-01-01  2020-12-31  4
AE93-AE-CS  2020-01-01  2020-12-31  4
AE93-AE-CS  2020-01-01  2020-12-31  4
AE93-AE-CS  2020-01-01  2020-12-31  4

我正在使用数据流:

enter image description here

结尾 Enddate 不会作为例外:

enter image description here

我已经检查到日期的方式是什么(ENDDATE,'YYYY-MM-DD') 这给出了 NULL。

解决方法

toDate() 条件中使用 iifNull() 条件,它会正常工作。此外,请确保日期格式中的 MM 应为大写。

例如:iifNull(toDate(start,'MM/dd/yyyy'),toDate(start,'dd-MM-yyyy'))

找到下面的片段。

源数据预览: enter image description here

派生列数据预览: enter image description here