The request

From Amanda Perez, Accountant
Your goal
Split transaction_id at each "-", keep only the number part as a whole-number column named order_id (drop the other two parts), then add a column product_customer that joins product_id, a hyphen and customer_code (for example 153-C01247).
- Show exactly
order_idorder_datecustomer_codeproduct_idquantityamountproduct_customernot done yet - 53 rowsnot done yet
Your sheet
| transaction_id | order_date | customer_code | product_id | quantity | amount | |
|---|---|---|---|---|---|---|
| 1 | TX-2025-008514 | 2025-02-01 | C01247 | 153 | 1 | 65.69 |
| 2 | TX-2025-008522 | 2025-02-01 | C00461 | 185 | 2 | 21.6 |
| 3 | TX-2025-008522 | 2025-02-01 | C00461 | 152 | 2 | 25.18 |
| 4 | TX-2025-008531 | 2025-02-02 | C00844 | 164 | 1 | 52.99 |
| 5 | TX-2025-008544 | 2025-02-04 | C00697 | 173 | 4 | 556 |
| 6 | TX-2025-008544 | 2025-02-04 | C00697 | 190 | 2 | 87.98 |
| 7 | TX-2025-008550 | 2025-02-04 | C00496 | 163 | 1 | 139 |
| 8 | TX-2025-008554 | 2025-02-04 | C00916 | 122 | 2 | 59.98 |
| 9 | TX-2025-008554 | 2025-02-04 | C00916 | 166 | 6 | 161.94 |
| 10 | TX-2025-008554 | 2025-02-04 | C00916 | 186 | 2 | 41.98 |
| 11 | TX-2025-008607 | 2025-02-11 | C01153 | 169 | 1 | 66.99 |
| 12 | TX-2025-008614 | 2025-02-12 | C00453 | 184 | 1 | 17.99 |
| 13 | TX-2025-008617 | 2025-02-12 | C00184 | 119 | 3 | 777 |
| 14 | TX-2025-008617 | 2025-02-12 | C00184 | 142 | 2 | 73.98 |
| 15 | TX-2025-008617 | 2025-02-12 | C00184 | 193 | 2 | 39.98 |
| 16 | TX-2025-008622 | 2025-02-13 | C01089 | 165 | 1 | 25.99 |
| 17 | TX-2025-008622 | 2025-02-13 | C01089 | 121 | 1 | 31.99 |
| 18 | TX-2025-008622 | 2025-02-13 | C01089 | 150 | 1 | 18.99 |
| 19 | TX-2025-008622 | 2025-02-13 | C01089 | 166 | 1 | 26.99 |
| 20 | TX-2025-008622 | 2025-02-13 | C01089 | 184 | 4 | 71.96 |
| 21 | TX-2025-008624 | 2025-02-13 | C00471 | 194 | 3 | 447 |
| 22 | TX-2025-008624 | 2025-02-13 | C00471 | 150 | 4 | 75.96 |
| 23 | TX-2025-008627 | 2025-02-13 | C01087 | 181 | 2 | 358 |
| 24 | TX-2025-008627 | 2025-02-13 | C01087 | 190 | 1 | 43.99 |
| 25 | TX-2025-008628 | 2025-02-13 | C00234 | 153 | 2 | 145.98 |
| 26 | TX-2025-008637 | 2025-02-14 | C01030 | 203 | 2 | 107.98 |
| 27 | TX-2025-008637 | 2025-02-14 | C01030 | 141 | 1 | 13.99 |
| 28 | TX-2025-008637 | 2025-02-14 | C01030 | 191 | 1 | 42.99 |
| 29 | TX-2025-008644 | 2025-02-15 | C01269 | 184 | 2 | 35.98 |
| 30 | TX-2025-008644 | 2025-02-15 | C01269 | 215 | 2 | 187.98 |
| 31 | TX-2025-008644 | 2025-02-15 | C01269 | 146 | 9 | 143.91 |
| 32 | TX-2025-008644 | 2025-02-15 | C01269 | 199 | 3 | 296.97 |
| 33 | TX-2025-008666 | 2025-02-18 | C00706 | 173 | 1 | 139 |
| 34 | TX-2025-008673 | 2025-02-19 | C01277 | 185 | 2 | 21.6 |
| 35 | TX-2025-008673 | 2025-02-19 | C01277 | 106 | 2 | 412.2 |
| 36 | TX-2025-008673 | 2025-02-19 | C01277 | 141 | 1 | 12.59 |
| 37 | TX-2025-008673 | 2025-02-19 | C01277 | 191 | 1 | 38.69 |
| 38 | TX-2025-008696 | 2025-02-22 | C00520 | 154 | 1 | 11.99 |
| 39 | TX-2025-008701 | 2025-02-22 | C00813 | 194 | 2 | 298 |
| 40 | TX-2025-008716 | 2025-02-24 | C00467 | 127 | 1 | 179 |
| 41 | TX-2025-008716 | 2025-02-24 | C00467 | 193 | 4 | 79.96 |
| 42 | TX-2025-008716 | 2025-02-24 | C00467 | 214 | 4 | 1036 |
| 43 | TX-2025-008716 | 2025-02-24 | C00467 | 112 | 2 | 1038 |
| 44 | TX-2025-008724 | 2025-02-25 | C01284 | 193 | 1 | 17.99 |
| 45 | TX-2025-008724 | 2025-02-25 | C01284 | 133 | 2 | 88.18 |
| 46 | TX-2025-008724 | 2025-02-25 | C01284 | 173 | 1 | 125.1 |
| 47 | TX-2025-008737 | 2025-02-27 | C00351 | 177 | 1 | 169 |
| 48 | TX-2025-008737 | 2025-02-27 | C00351 | 106 | 1 | 229 |
| 49 | TX-2025-008737 | 2025-02-27 | C00351 | 150 | 1 | 18.99 |
| 50 | TX-2025-008743 | 2025-02-28 | C00989 | 159 | 1 | 179 |
| 51 | TX-2025-008743 | 2025-02-28 | C00989 | 139 | 2 | 358 |
| 52 | TX-2025-008747 | 2025-02-28 | C00009 | 187 | 1 | 149 |
| 53 | TX-2025-008747 | 2025-02-28 | C00009 | 164 | 1 | 52.99 |
Loading the editor…
Reference solution
Mote checks your result
Press Check. Each row of the result that matches becomes a firefly in your lantern.
What Amanda gets, and why
The lesson
Exports from other systems rarely use your ids as they are. The marketplace wraps our order
number in a transaction code, TX-2025-008514, and Amanda needs the plain number back to match
the report against our orders. That is a Split Column job. Then she needs the opposite: two
columns combined into one key.
Split a column by a delimiter
Split column: transaction_id by "-"
Power Query cuts the text at every hyphen and puts each piece in its own column, named after the
original with .1, .2, .3:
| transaction_id | → transaction_id.1 | transaction_id.2 | transaction_id.3 |
|---|---|---|---|
TX-2025-008514 |
TX |
2025 |
008514 |
The three new columns take the place of transaction_id, which is gone. Keep the piece you need and
remove the others:
Remove columns: transaction_id.1, transaction_id.2
Rename column: transaction_id.3 to order_id
In Excel: select the column, Home → Split Column → By Delimiter, pick --Custom-- and type
-, choose Each occurrence of the delimiter. Rename by double-clicking the header.
The number part is still text
008514 is text: the leading zeros give it away, because a number has none. Our order ids are
numbers (8514), so text "008514" would never match them in a lookup or a merge. One more step
fixes it:
Change type: order_id to whole number
Real Excel usually adds this one by itself: right after a split, Power Query inserts a
Changed Type step that guesses the new columns’ types. Always look at what it guessed. A code
like 00123 that must keep its zeros (a ZIP code, a SKU) has to stay text.
Combine two columns into a key
The chargeback list identifies an item as 153-C01247: the product id, a hyphen, the customer
code. Build the same key with a custom column:
Add column: product_customer = Text.From([product_id]) & "-" & [customer_code]
& joins text. product_id is a number, and M, unlike an Excel cell formula, refuses to join a
number to text: [product_id] & "-" is an error on every row. Text.From converts the number to
text first. On the first row this gives 153-C01247.
In Excel the point-and-click version is Add Column → Merge Columns: select product_id, then
customer_code (the click order is the order in the result), pick a custom separator -, and
name the new column. Use the Transform tab’s Merge Columns instead if you want the two
originals replaced rather than kept.
The M behind the steps
Table.SplitColumn(Source, "transaction_id",
Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv),
{"transaction_id.1", "transaction_id.2", "transaction_id.3"})
Table.TransformColumnTypes(#"Renamed Columns", {{"order_id", Int64.Type}})
Table.AddColumn(#"Changed Type", "product_customer",
each Text.Combine({Text.From([product_id]), [customer_code]}, "-"), type text)
Int64.Type is a whole number; type number is a decimal.
Common mistakes
- Joining a number with
&. Wrap it inText.From( )or change its type to text first. - Keeping all three split columns. The checker, like the person reading your table, only wants the order number.
- Leaving
order_idas text. It shows008514, and a merge against the orders table finds nothing. - Splitting with a delimiter that also appears inside the data. A product name like
Oak-Leaf Vasesplit by-lands in two columns. Check the values before you pick a delimiter.
Lantern lit!
Practised: power querysplit columnmerge columnsrename columnchange typecustom column
- Solved
- No hints
- First run
