Forum Discussion
Lookup % Rebate on another table based on Invoice quantity
NewStep=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)
Hi Daniel,
Thanks for your reply.
However based on your formula each Customer Code got duplicate into many lines with different %Rebate
- wdx223_Daniel3 years agoCommunity Champion
NewStep=let a=Table.Buffer(Table.Group(TableA,"Key",{"n",each Table.ToRows(Table.Sort(_,"Min"))})) 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)
- k33fun3 years agoFrequent Visitor
Hi Daniel,
Table A = CTC_Rule
Table B = Cognos_Total_PivotBelow error message appear
- wdx223_Daniel3 years agoCommunity Champion
try to delete those code