英文:
Power Query : Add Week column using the column position
问题
我想要添加一个新列,显示从另一个日期列获取的每周日期。
这段代码有效:
#"添加星期几" = Table.AddColumn(#"添加日期", "星期几", each Date.DayOfWeek([DATE_JOURNEE_PRODUCTION], Day.Monday))
但是,我无法用日期列的名称(称为DATE_JOURNEE_PRODUCTION)来替代该列在表中的位置。
我尝试替换代码为:
#"添加星期几" = Table.AddColumn(#"添加日期", "星期几", each Date.DayOfWeek(Table.ColumnNames(#"扩展的数据"){1}, Day.Monday))
但这里的Table列名不起作用。
有人可以帮助我吗?
谢谢!
英文:
I want to add a new column with the day of the week, from another date column.
This code works :
#"Add DAY OF WEEK" = Table.AddColumn(#"Add DAY", "WEEK DAY", each Date.DayOfWeek([DATE_JOURNEE_PRODUCTION], Day.Monday))
But I cannot replace the name of the date column (called DATE_JOURNEE_PRODUCTION) by the position of this column in the table.
I'm trying to replace the code for something like
#"Add DAY OF WEEK" = Table.AddColumn(#"Add DAY", "WEEK DAY", each Date.DayOfWeek(Table.ColumnNames(#"Expanded Data"){1}, Day.Monday))
But this Table column names is not working.
Anybody could help me ?
Thank you !
Create a new column using the position of another colum
答案1
得分: 0
尝试
每个 Date.DayOfWeek(Record.Field(_, Table.ColumnNames("Expanded Data"){1}), Day.Monday)
英文:
try
each Date.DayOfWeek(Record.Field(_,Table.ColumnNames(#"Expanded Data"){1}), Day.Monday)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论