Append and schema alignment
Append observations, merge attributes
Append stacks records from tables at the same intended grain. Merge matches keys to add information or select matching observations. Table.Combine accepts a list of tables and normally derives the union of their column schemas. Columns align by name, not position; missing values appear as null. Append does not deduplicate, validate keys, repair units or reconcile incompatible periods. Retain a batch/source identifier and validate the common schema before loading. All M examples are standalone expressions for a blank query in a disposable Power BI Desktop Import lab. No credentials, external connector or paid service are required. Outputs are predictions; native M execution and exact Desktop build are NOT RUN. Treat row order as unspecified unless explicitly sorted.
Align columns by name
let Jan = #table(type table [LineID=text, RevenueUSD=number],{{"J1",30},{"J2",20}}), Feb = #table(type table [RevenueUSD=number, LineID=text, Channel=text],{{40,"F1","Web"}}), A = Table.AddColumn(Jan,"Batch",each "Jan",type text), B = Table.AddColumn(Feb,"Batch",each "Feb",type text), Combined = Table.Combine({A,B}), Typed = Table.TransformColumnTypes(Combined,{{"LineID",type text},{"RevenueUSD",Currency.Type},{"Channel",type text},{"Batch",type text}},"en-US")in TypedThree rows: J1 30, J2 20, F1 40; total 90 USD. Jan Channel is null because the field was absent. This is not the same as a recorded blank channel or a classification of Offline. The changed column order in Feb has no effect on matching. Currency.Type is fixed decimal; this fixture uses integer USD values. If one batch used cents or another currency, rename or convert under an explicit contract before appending.
Fail on missing required fields; allow optional fields explicitly
let Prepare = (T as table, Batch as text) as table => let Required = Table.SelectColumns(T,{"LineID","RevenueUSD"}), Optional = if Table.HasColumns(T,"Channel") then Table.SelectColumns(T,{"LineID","RevenueUSD","Channel"}) else Table.AddColumn(Required,"Channel",each null,type nullable text), Typed = Table.TransformColumnTypes(Optional,{{"LineID",type text},{"RevenueUSD",Currency.Type},{"Channel",type text}},"en-US") in Table.AddColumn(Typed,"Batch",each Batch,type text), A = #table(type table [LineID=text, RevenueUSD=number],{{"J1",30}}), B = #table(type table [LineID=text, RevenueUSD=number, Channel=text],{{"J1",30,"Web"}}), All = Table.Combine({Prepare(A,"Jan"),Prepare(B,"Feb")}), Counts = Table.Group(All,{"LineID"},{{"Rows",each Table.RowCount(_),Int64.Type}}), Repeated = Table.SelectRows(Counts,each [Rows]>1)in [Combined=All, Repeated=Repeated]Two rows, total 60 USD, one repeated key J1. The duplicate must be investigated: it might be a replay or an ID scoped to a source. If global LineID uniqueness is required, reject the overlapping records until resolved; if the source contract declares a composite ID, test that grain instead. Missing LineID or RevenueUSD fails rather than creating a misleading nullable mandatory field. The helper projects a reviewed column set; separately flag unexpected fields in a production schema audit. It does not check row-level null keys or conversion errors; extend the reject policy from earlier chapters before production.
Choose a safe integration boundary
Before combining sources, verify column definitions, key domains, date scope, currency, ownership and approved permissions. Reconcile per-batch counts and sums; keep a record of rejected rows and duplicate identifiers. Append and merge can both be partially folded where supported; never infer folding from UI step order or a successful preview. Keep a source-level audit and test the final loaded result. Neither operation establishes a semantic-model relationship automatically.
Practice: handle a replay
Append another row F1 with 40 USD to the first fixture. Predict the raw count and total. If LineID is globally unique, quarantine both F1 records pending review; compute the accepted and quarantined totals. State why simply removing duplicates might be wrong when their metadata differs.