let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"EmployeeCode", Int64.Type}, {"EmployeeName", type text}, {"9/1/2020", type text}, {"9/2/2020", type text}, {"9/3/2020", type text}, {"9/4/2020", type text}, {"9/5/2020", type text}, {"9/6/2020", type text}, {"9/7/2020", type text}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"EmployeeCode", "EmployeeName"}, "Attribute", "Value")
in
#"Unpivoted Other Columns"
= UNPIVOT(Table,dates,headers,"Date","Output",1)
= LET(
n, COUNTA(input),
k, SEQUENCE(n, 1, 0),
dateIndex, 1+MOD(k, COUNT(dates)),
emplIndex, 1+QUOTIENT(k, COUNT(dates)),
INDEX(input, emplIndex, dateIndex) )
The employee code and name could be returned by
INDEX(employee, emplIndex, {1,2})
and the dates by
INDEX(dates, dateIndex)
The output is as shown above
INDEX(input, emplIndex, dateIndex)
= LET(
n, COUNTA(input),
k, SEQUENCE(n,1,0),
dateIndex, 1+MOD(k, COUNT(dates)),
emplIndex, 1+QUOTIENT(k, COUNT(dates)),
code, INDEX(EmployeeCode, emplIndex),
name, INDEX(EmployeeName, emplIndex),
date, INDEX(dates, dateIndex),
output, INDEX(input, emplIndex, dateIndex),
CHOOSE({1,2,3,4}, code, name, date, output) )
index
-formula as I used.#NAME?
... I would solve those 'my way', but this time I tried to be patient.= LET(
n, COUNT(dates)*COUNT(EmployeeCode),
k, SEQUENCE(n,1,0),
dateIndex, 1+MOD(k, COUNT(dates)),
emplIndex, 1+QUOTIENT(k, COUNT(dates)),
code, INDEX(EmployeeCode, emplIndex),
name, INDEX(EmployeeName, emplIndex),
date, INDEX(dates, dateIndex),
output, INDEX(input, emplIndex, dateIndex),
table, CHOOSE({1,2,3,4}, code, name, date, output),
FILTER(table, output<>"") )