Forum Discussion
Flat BOM with Multiple Parents Components
- 1 year ago
1. Yes it is. Merely a matter of changing how you expand the Joined table:
let Source = Excel.CurrentWorkbook(){[Name="BillOfMaterial"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{ {"Integrated_Check_Valve", type text}, {"Connection_Type_Front_Port", type text}, {"Valve_Function", type text}, {"Voltage", type text}, {"Sealing_Material", type text}, {"Power_Consumption", type text}, {"Pipe_Size_Front_Port", type text}, {"Pipe_Size_Side_Port", type text}, {"Orifice_Size", type text}, {"Core SubAssy", type text}}), #"Add Blank Rows" = List.Accumulate( {1..Table.RowCount(#"Changed Type")-1}, {}, (s,c)=> s & {#"Changed Type"{c}, Record.FromList( List.Repeat({null},Table.ColumnCount(#"Changed Type")), Table.ColumnNames(#"Changed Type"))}), #"To Table" = Table.FromRecords(#"Add Blank Rows", type table [Integrated_Check_Valve=text,Connection_Type_Front_Port= text, Valve_Function=text, Voltage=text, Sealing_Material=text, Power_Consumption=text, Pipe_Size_Front_Port=text, Pipe_Size_Side_Port=text, Orifice_Size=text, Core SubAssy=text]), #"Join Core SubAssy" = Table.NestedJoin(#"To Table","Core SubAssy", Core_SubAssy,"Part Number", "Part Numbers", JoinKind.LeftOuter), #"Move Join Down" = Table.FromColumns( Table.ToColumns(#"To Table") & {{#table({},{})} & List.RemoveLastN(#"Join Core SubAssy"[Part Numbers],1)},Table.ColumnNames(#"Join Core SubAssy")), #"Extract Part Nums" = Table.TransformColumns(#"Move Join Down", {"Part Numbers",each try List.Transform(List.Skip(Record.FieldValues(Table.ToRecords(_){0}),3), each Text.From(_)) otherwise null, type {text}}), #"Expanded Join" = Table.ExpandListColumn(#"Extract Part Nums", "Part Numbers") in #"Expanded Join"To get:
2. Yes you may.
3. You may also mark one or both answers as accepted, if they meet your requirements.
Your function seems to work OK and outputs the desired table given what I think are proper inputs. So the problem would seem to be in your data set or your calling query. The error message suggests a naming conflict.
Yes exactly, each time I call the function, the column is always named "Part Numbers". Is it possible, in your opinion to link the name "Part Numbers" to the father column name (e.g. "Core Tube SubAssy Part Number")?
- ronrsnfld1 year agoSuper User
With no representative data and desired output from that data, I can't really tell what you are doing. But, if you are creating multiple tables from a given data set, you might want to look into combining the tables created by your function, instead of merging the created table. You could use LIst.Accumulate for the combining.