Forum Discussion
Anonymous
3 years agoNot applicable
Total quantities from an indented BOM list - make the code dynamic based on the number of levels
I have some code which finds me the total quantity of items that are in an indented Bill of Materials (BOM) list. The BOM list is a hierarchy of parent and child relationships, and these relationship...
wdx223_Daniel
3 years agoCommunity Champion
= #table(Table.ColumnNames(Source)&{"Total QTY"},Record.ToList(List.Accumulate(Table.ToRows(#"Changed Type"),[],(x,y)=>Record.TransformFields(x,{y{0},each y&{Record.FieldOrDefault(x,Text.BeforeDelimiter(y{0},".",{0,1}),{}){2}?*y{1}??y{1}}},2))))
the parent level must present before children level, or will get wrong result.