Forum Discussion
k33fun
3 years agoFrequent Visitor
Lookup % Rebate on another table based on Invoice quantity
Hi, I want to get the correct % Rebate from table A into table B based on the Invoice Qty of each Customer. How can I get it done via power query? Table A Table B
wdx223_Daniel
Community Champion
3 years agoNewStep=let a=Table.Buffer(Table.Group(TableA,"Key",{"n",Table.ToRows})) in Table.AddColumn(TableB,"%Rebate",each let lst=a{[Key=[Year_Chaneel]]}?[n]? in if lst=null then 0 else List.Last(List.RemoveLastN(lst,(x)=>x{1}>[Invoice Qty]),{}){2}? ??0)