Timedora

Combining and Reshaping Data in Power Query

A practical lesson on choosing append, merge, and unpivot operations in Power Query, then checking a repeatable preparation flow before loading data.

rows or related records

Choose by the tables’ roles

In Power Query, and solve different problems. is for tables that contain the same kind of records and should form one longer table. For example, January and February sales records can be appended into a single sales table: the rows from one table are stacked with the rows from the other.

Power Query aligns appended columns by header name, not by their position. Standardize column names and data types before appending. If a column exists in only one input, rows from the input without that column receive null in it. Add a source or period column when you need to retain which table or period each row came from.

Use when one table needs fields from another based on matching key values. For example, sales with a customer table on CustomerID to bring customer names into the sales data. The matching columns may have different names, but their data types should be compatible. If the key uses multiple columns, select those columns in the same order in both tables.

Choose a according to which records the result should retain. A left outer join keeps every row from the left table and brings in matching rows from the right; an inner join keeps only rows with matches. So, if the goal is to retain every sales row while adding customer details where available, a left outer join fits that goal. If the result should contain only sales rows with a matching customer record, use an inner join.

Validate the before loading. Check that the keys represent the same thing in both tables and have no unintended blanks or formatting differences. When one lookup match per fact row is expected, check for duplicate lookup keys: expanding duplicate matches can multiply rows. Review the match estimate, expand only the fields needed, and inspect unmatched records; a left anti join can isolate left-table rows without a match. Compare row counts before and after expansion and investigate unexpected changes.

The key distinction is the result you want: adds records; adds related fields by matching records.

Unpivot wide tables without losing context

Turn repeated columns into rows

A wide table stores related values in separate columns—for example, one row per product with columns for Jan, Feb, and Mar. Unpivoting turns those month headers into an column and their cell contents into a column. This row-based structure is easier to filter, group, chart, and extend to new periods.

For example, the source row for product P01 contains 12 for January, 15 for February, and 11 for March. Unpivoting those three month columns gives three rows: P01–Jan–12, P01–Feb–15, and P01–Mar–11. Each row keeps the product identifier while pairing one month with its .

Keep every column that identifies the original record—such as ProductID, region, or year—outside the unpivot operation. In Power Query, select those identifiers and choose Unpivot Other Columns when all remaining columns are measures or periods. This also includes newly added period columns on refresh. Choose Unpivot Columns when you want to reshape only specific columns; newly added columns will not be included automatically.

Afterward, rename and to meaningful names, such as Month and Units, and set their data types deliberately. Check that identifier– combinations produce the expected rows, that values retain their meaning and type, and that identifiers still distinguish records. With n source records and m period columns, a complete unpivot typically produces n × m rows, unless blank values are omitted or filtered.

Build and validate a repeatable flow

Make preparation repeatable

A dependable Power Query flow connects the table operations to checks that can be repeated after refresh:

  1. Connect to each source, then standardize column names and data types.

  2. tables with the same kind of records. only when related fields are needed from another table.

  3. Before expanding merged fields, confirm that the keys mean the same thing in both tables and have no unintended blanks or formatting differences. Review the match estimate. If one match per fact row is expected, check for duplicate lookup keys: expanding duplicate matches can multiply rows. Expand only the fields needed, compare row counts before and after expansion, and investigate unexpected changes. A left anti join can isolate left-table rows without a match.

  4. When reshaping period or category columns, preserve the identifiers that distinguish the original records and check the resulting rows and values.

  5. Profile the output for errors, empty values, and unexpected distributions. Profiling defaults to the first 1,000 rows, so switch to the entire dataset when full-data checks are needed.

  6. Name queries and steps clearly. Refresh, then verify final row counts and key measures before loading.

These checks connect the transformation choice to its intended result: should combine like-for-like records, should add fields through appropriate keys, and unpivot should preserve record identity while reshaping values.

  • : Examining output for errors, empty values, and unexpected distributions.