Forum Discussion
smko
Helper I
5 years agoAllocation of header table into detail table
I want to allocate the discount amount happened at the invoice level into line item evenly. Basically the discount will spread evenly into each item, for example InvoiceID 1 has 2 items, hence 20/2 =...
- 5 years ago
smko
Please check the attached file. I merged the discount table and added a custom column to divided by the invoice ID count.
Fowmy
Super User
5 years agosmko
Please check the attached file. I merged the discount table and added a custom column to divided by the invoice ID count.
smko
Helper I
5 years agoThanks Fowmy! I'm new to M, could you explain the meaning of (x)=> and the "x" in front of [Discount] and [InvoiceID]?
(x)=>
x[Discount]/
List.Count(
List.Select( #"Merged Queries"[InvoiceID] , each _ = x[InvoiceID])
)