[URL=#]?[/URL] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 let Джерело = Excel.CurrentWorkbook(), # "Шаг 1" = Table.SelectRows(Джерело, each ([Name] <> "DAP" )), # "Шаг 2" = Table.ExpandTableColumn(# "Шаг 1" , "Content" , { "Contract" , "app." , "Customer" , "Seller" , "Quality of cargo" , "Direction" , "Date" , "Train №" , "Wag." , "Weight" , "Fe (%)" , "RWB" , "CROSS DD" , "Invoice №" , "PLANNED CROSS DD" , "on the road in the last 7 days" , "on way" , "Staus" , "Note" }, { "Contract" , "app." , "Customer" , "Seller" , "Quality of cargo" , "Direction" , "Date" , "Train №" , "Wag." , "Weight" , "Fe (%)" , "RWB" , "CROSS DD" , "Invoice №" , "PLANNED CROSS DD" , "on the road in the last 7 days" , "on way" , "Staus" , "Note" }), # "Шаг 3" = Table.RemoveColumns(# "Шаг 2" ,{ "Contract" , "app." , "Seller" , "Train №" , "Fe (%)" , "RWB" , "Invoice №" }), # "Шаг 4" = Table.Group(# "Шаг 3" , { "Direction" }, {{ "Кількість" , each _, type table}}), # "Шаг 5" = Table.RenameColumns(# "Шаг 4" ,{{ "Кількість" , "Table" }}), # "Шег 6" = Table.AddColumn(# "Шаг 5" , "Index" , each Table.AddIndexColumn([Table], "index" , 1, 1)), # "Шаг 7" = Table.SelectColumns(# "Шег 6" ,{ "Index" }), Table = Table.ExpandTableColumn(# "Шаг 7" , "Index" , { "Contract" , "app." , "Customer" , "Seller" , "Quality of cargo" , "Direction" , "Date" , "Train №" , "Wag." , "Weight" , "Fe (%)" , "RWB" , "CROSS DD" , "Invoice №" , "PLANNED CROSS DD" , "on the road in the last 7 days" , "on way" , "Staus" , "Note" , "Name" , "index" }, { "Contract" , "app." , "Customer" , "Seller" , "Quality of cargo" , "Direction" , "Date" , "Train №" , "Wag." , "Weight" , "Fe (%)" , "RWB" , "CROSS DD" , "Invoice №" , "PLANNED CROSS DD" , "on the road in the last 7 days" , "on way" , "Staus" , "Note" , "Name" , "index.1" }), # "Шаг 9" = Table.RemoveColumns(Table,{ "Contract" , "app." , "Seller" , "Train №" , "Fe (%)" , "RWB" , "Invoice №" }), typed = Table.Buffer(Table.TransformColumnTypes(# "Шаг 9" ,{{ "Date" , type date}, { "CROSS DD" , type date}})), # "Шаг 10" = Table.AddColumn(typed, "On Road Last 7 Days" , each fn_OnRoadLast7Days(typed, [Direction])) in # "Шаг 10" |