将文本列格式设置为日期,除非有特定文本
我是 Power Query 的新手。
我有一个包含所有文本字段的数据库,可以根据业务目的将其填充到 Excel 电子表格中。我不允许在电子表格中添加或删除表格。我遇到的问题是“结束日期”列。
如果有开始日期但没有结束日期,“结束日期”列可以采用日期格式或“TBD”文本。
本质上,我需要强大的查询来将“结束日期”列中的传入内容格式化为日期,除非该行包含“TBD”。在这种情况下,我需要将该行保留为“TBD”。然而,正如您从上图中看到的,它无法正确填充。
这是我一直试图实现的公式,但我没有任何运气。有办法完成这个任务吗?
= 表.TransformColumns( _qryPerstat,{{"END DT", 每个 if qryPerstat[END DT] = "TBD" then "TBD" else Date.From(DateTimeZone.From()), type date}})
I am new to Power Query.
I have a database, containing all text fields, to populate onto an excel spreadsheet as a requirement for business purposes. I am not allowed to add or delete tables in the spreadsheet. The problem I'm having is with the End Date column.
The End Date column can either have a date format or "TBD" as text if there is a start date but no end date.
Essentially I need power query to format the incoming in the End Date column as a date, unless the row contains "TBD". In that case I need the row to remain as "TBD". However as you can see from the picture above, it fails to populate correctly.
This is the formula I've been trying to get working but I haven't had any luck. Is there a way to accomplish this task?
= Table.TransformColumns(
_qryPerstat,{{"END DT",
each if qryPerstat[END DT] = "TBD" then "TBD" else Date.From(DateTimeZone.From()), type date}})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论