[JavaScript] 纯文本查看 复制代码
let
源 = #table({"工单号","创建时间"},{{"A14981",#datetime(2022,7,18,1,16,38)},{"A23369",#datetime(2022,7,18,4,22,36)},{"A66258",#datetime(2022,7,18,7,27,55)},{"A38457",#datetime(2022,7,18,7,35,11)},{"A43493",#datetime(2022,7,18,7,48,42)},{"A72556",#datetime(2022,7,18,8,3,15)},{"A73891",#datetime(2022,7,18,8,9,42)},{"A67268",#datetime(2022,7,18,8,10,20)},{"A23369",#datetime(2022,7,18,8,18,0)},{"A57730",#datetime(2022,7,18,8,19,22)},{"A80632",#datetime(2022,7,18,8,24,11)},{"A23369",#datetime(2022,7,18,8,32,27)},{"A85477",#datetime(2022,7,18,8,42,57)},{"A66258",#datetime(2022,7,18,8,54,37)},{"A74534",#datetime(2022,7,18,8,54,44)},{"A10964",#datetime(2022,7,18,9,0,37)},{"A69654",#datetime(2022,7,18,9,3,20)},{"A76752",#datetime(2022,7,18,9,3,36)},{"A33742",#datetime(2022,7,18,9,3,37)},{"A16170",#datetime(2022,7,18,9,3,54)},{"A76123",#datetime(2022,7,18,9,8,39)},{"A31725",#datetime(2022,7,18,9,10,3)},{"A18579",#datetime(2022,7,18,9,15,46)},{"A84359",#datetime(2022,7,18,9,15,47)},{"A39633",#datetime(2022,7,18,9,17,4)},{"A87179",#datetime(2022,7,18,9,17,33)},{"A58260",#datetime(2022,7,18,9,17,40)},{"A11409",#datetime(2022,7,18,9,17,47)},{"A54634",#datetime(2022,7,18,9,22,7)},{"A82306",#datetime(2022,7,18,9,22,11)}}),
添加列索引 = Table.AddIndexColumn(源, "索引", 1, 1, Int64.Type),
重排序列 = Table.ReorderColumns(添加列索引,{"索引", "工单号", "创建时间"}),
添加列本账号总数 = Table.AddColumn(重排序列,"本账号总数",each List.Count(List.Select(重排序列[工单号],(x)=>x=[工单号]))),
添加列本账号累计数 = Table.AddColumn(添加列本账号总数,"本账号累计数",each List.PositionOf(Table.SelectRows(添加列本账号总数,(x)=>x[工单号]=[工单号])[索引],[索引])+1),
添加列上次创建时间 = Table.AddColumn(添加列本账号累计数,"上次创建时间",each if [本账号累计数] <=1 then "" else Table.SelectRows(添加列本账号累计数,(x)=>x[工单号]=[工单号])[创建时间]{[本账号累计数]-2})
in
添加列上次创建时间