Forum Discussion
MCstudio
4 years agoHelper I
Merge by condition and approximate matching in Power Query
Hi community! I have got a question. We have got clients, who do orders, and managers, who control orders. The final goal is to understand, which manager provide what volume of orders. But, during ...
wdx223_Daniel
4 years agoCommunity Champion
let
OrderTable = Excel.CurrentWorkbook(){[Name="OrderTable"]}[Content],
ManagerTable = Excel.CurrentWorkbook(){[Name="ManagerTable"]}[Content],
Custom1 = let
mt=Table.Group(
ManagerTable,
"Client",
{"n",each Table.ToRows(Table.Sort(_,{"Manager Change Date",1}))}
)
in
Table.AddColumn(
OrderTable,
"Manager",
each let
a=mt{[Client=[Client]]}?[n]?
in
if a=null then "Mng.1"
else List.Skip(a,(x)=>x{1}>[Order Date]){0}?{2}? ??"Mng.1"
)
in
Custom1- MCstudio4 years agoHelper I
An error appeared