如何按天 "Merge" table 个具有唯一员工姓名的日期
How to "Merge" a table of dates with exclusive employee names by day
我有两个表,一个有日期,另一个有名字,我想做的是将这两个表“合并”到另一个表中,就像下面的例子一样,每天只有一个人重复最后一个 (F).
tables
感谢
基于此设置
读取每个步骤名称:
let
Origen = Excel.CurrentWorkbook(){[Name="Tabla1"]}[Content],
ExtractDates = Table.AddColumn(Origen, "SingleDate", each Text.BeforeDelimiter([Date], " "), type text),
ChangeTypes = Table.TransformColumnTypes(ExtractDates,{{"SingleDate", type date}}),
AddDayOfWeek = Table.AddColumn(ChangeTypes, "Día de la semana", each Date.DayOfWeek([SingleDate]), Int64.Type),
FilterWeekends = Table.SelectRows(AddDayOfWeek, each ([Día de la semana] <> 0 and [Día de la semana] <> 6)),
AddIndex = Table.AddIndexColumn(FilterWeekends, "Índice", 0, 1, Int64.Type),
RestartIndexEverySixRows = Table.TransformColumns(AddIndex,{{"Índice", (index) => Number.Mod(index, 6) + 1, type number}}),
MergeTablePerson = Table.NestedJoin(RestartIndexEverySixRows, {"Índice"}, TablePerson, {"ID"}, "TableLetter", JoinKind.LeftOuter),
ExpandName = Table.ExpandTableColumn(MergeTablePerson, "TableLetter", {"Name"}, {"Name"}),
RemoveCols = Table.RemoveColumns(ExpandName,{"Día de la semana", "Índice"}),
MergeExpandName = Table.NestedJoin(ExtractDates, {"Date"}, ExpandName, {"Date"}, "Se expandió TableLetter", JoinKind.LeftOuter),
ExpandName2 = Table.ExpandTableColumn(MergeExpandName, "Se expandió TableLetter", {"Name"}, {"Name"}),
OrderByDate = Table.Sort(ExpandName2,{{"SingleDate", Order.Ascending}}),
RemoveCol = Table.RemoveColumns(OrderByDate,{"SingleDate"})
in
RemoveCol
我有两个表,一个有日期,另一个有名字,我想做的是将这两个表“合并”到另一个表中,就像下面的例子一样,每天只有一个人重复最后一个 (F).
tables
感谢
基于此设置
读取每个步骤名称:
let
Origen = Excel.CurrentWorkbook(){[Name="Tabla1"]}[Content],
ExtractDates = Table.AddColumn(Origen, "SingleDate", each Text.BeforeDelimiter([Date], " "), type text),
ChangeTypes = Table.TransformColumnTypes(ExtractDates,{{"SingleDate", type date}}),
AddDayOfWeek = Table.AddColumn(ChangeTypes, "Día de la semana", each Date.DayOfWeek([SingleDate]), Int64.Type),
FilterWeekends = Table.SelectRows(AddDayOfWeek, each ([Día de la semana] <> 0 and [Día de la semana] <> 6)),
AddIndex = Table.AddIndexColumn(FilterWeekends, "Índice", 0, 1, Int64.Type),
RestartIndexEverySixRows = Table.TransformColumns(AddIndex,{{"Índice", (index) => Number.Mod(index, 6) + 1, type number}}),
MergeTablePerson = Table.NestedJoin(RestartIndexEverySixRows, {"Índice"}, TablePerson, {"ID"}, "TableLetter", JoinKind.LeftOuter),
ExpandName = Table.ExpandTableColumn(MergeTablePerson, "TableLetter", {"Name"}, {"Name"}),
RemoveCols = Table.RemoveColumns(ExpandName,{"Día de la semana", "Índice"}),
MergeExpandName = Table.NestedJoin(ExtractDates, {"Date"}, ExpandName, {"Date"}, "Se expandió TableLetter", JoinKind.LeftOuter),
ExpandName2 = Table.ExpandTableColumn(MergeExpandName, "Se expandió TableLetter", {"Name"}, {"Name"}),
OrderByDate = Table.Sort(ExpandName2,{{"SingleDate", Order.Ascending}}),
RemoveCol = Table.RemoveColumns(OrderByDate,{"SingleDate"})
in
RemoveCol