Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
try this
Custom1 =
Table.AddColumn(
Data,
"Rebate",
each
List.Select(
Table.ToRows( Table.ReverseRows( Rebate ) ),
(x)=> x{0} = [Year Channel] and x{1} <= [Invoice Qty]
){0}?{2}? ?? 0
)
Hi Kirete,
Still get the same result, duplicating the records for each customer code with different %Rebate
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
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)
Hi Daniel,
Table A = CTC_Rule
Table B = Cognos_Total_Pivot
Below error message appear
try to delete those code
origin is like this but after save it show me that error message
no need open this windows, jut put those code in the editor pane which is after "fx" lable
OK i got it but still appear the same error
what's the relationship between those two tables? does one table comes from the other?
It is a many to many relationship between these 2 tables applied.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
7 | |
6 | |
6 |