1. Lighthouse

Level 3 · Split a SKU into the parts you can join on

The request

From Luis Ortega, Warehouse Supervisor

“Our logistics partner sends a monthly shipping file keyed by their SKU, like LIG-PEN-0127. The last part is our product number and the first part is the category. I need both as separate columns so the file lines up with our products table, but keep the SKU itself, it's what their support team asks about.”

Your goal

The Source step is October 2025's shipping file for Lighting and Kitchen (sku, description, units_shipped). Keep sku as it is, and add category_code (the part before the first hyphen, e.g. LIG) and product_id (the last part as a whole number, e.g. 127). Drop the middle part.

  • Show exactly sku description units_shipped category_code product_idnot done yet
  • 38 rowsnot done yet

Your query steps

Power Query
The sheet for this level
skudescriptionunits_shipped
1KIT-COO-0141Thatcher Acacia Dutch Oven15
2KIT-COO-0145Cove Cast Iron Dutch Oven45
3KIT-COO-0149Hazel Stainless Dutch Oven4
4KIT-COO-0153Alder Acacia Dutch Oven10
5KIT-COO-0157Oakley Enamel Dutch Oven25
6KIT-DIN-0142Upland Acacia Serving Platter13
7KIT-DIN-0146Thatcher Cast Iron Bowl Set24
8KIT-DIN-0154Vale Enamel Bowl Set39
9KIT-DIN-0158Hazel Porcelain Serving Platter9
10KIT-GLA-0143Pine Cast Iron Carafe4
11KIT-GLA-0147Cedar Cast Iron Tumbler Set11
12KIT-GLA-0151Glen Stoneware Carafe42
13KIT-GLA-0155Tidewater Stainless Wine Glasses14
14KIT-GLA-0159Driftwood Porcelain Carafe3
15KIT-UTE-0144Hazel Porcelain Cutting Board7
16KIT-UTE-0148Spruce Enamel Utensil Set9
17KIT-UTE-0152Monroe Stoneware Utensil Set24
18KIT-UTE-0156Willow Acacia Knife Block19
19KIT-UTE-0160Fairhaven Stoneware Cutting Board17
20LIG-FLO-0121Bramble Ceramic Floor Lamp21
21LIG-FLO-0125Pacifica Black Metal Arc Lamp2
22LIG-FLO-0129Dune Ceramic Arc Lamp10
23LIG-FLO-0133Dune Black Metal Floor Lamp6
24LIG-FLO-0137Marlow Linen Floor Lamp3
25LIG-PEN-0123Sutton Brass Chandelier21
26LIG-PEN-0127Dune Black Metal Pendant Light23
27LIG-PEN-0131Ashford Linen Pendant Light7
28LIG-PEN-0135Ridge Ceramic Chandelier22
29LIG-PEN-0139Rowan Ceramic Chandelier19
30LIG-SCO-0124Marlow Glass Wall Sconce17
31LIG-SCO-0128Delancey Black Metal Wall Sconce17
32LIG-SCO-0132Fairhaven Brass Wall Sconce16
33LIG-SCO-0136Quarry Rattan Picture Light1
34LIG-SCO-0140Quarry Ceramic Picture Light1
35LIG-TAB-0122Monroe Glass Desk Lamp45
36LIG-TAB-0130Pacifica Black Metal Table Lamp6
37LIG-TAB-0134Sable Linen Table Lamp21
38LIG-TAB-0138Oakley Brass Table Lamp23

Loading the editor…

    ResultPress Check to compare the query result

    Mote checks your result

    Press Check. Mote fills in your answer and compares it with what the report needs.

    The lesson

    Codes from other systems pack several facts into one string. LIG-PEN-0127 is Lighting, the Pendants subcategory, product 127. To line the file up with your products table you need the pieces as their own columns, and Luis wants the original kept.

    Keep the original: Duplicate column

    Most splitting steps replace the column they work on. When the original has to stay, copy it first:

    Duplicate column: sku

    In Power BI: right-click the sku header → Duplicate Column (or Add Column → Duplicate Column). The copy is called sku - Copy, and the M is Table.DuplicateColumn(Source, "sku", "sku - Copy").

    Split by a delimiter

    Split column: sku - Copy by "-"

    In Power BI: select the column, Home → Split Column → By Delimiter, choose Custom and type -, and keep Each occurrence of the delimiter. The copy becomes three columns named after it with .1, .2, .3:

    sku - Copy → sku - Copy.1 sku - Copy.2 sku - Copy.3
    LIG-PEN-0127 LIG PEN 0127

    The same menu splits By Number of Characters, By Positions, by Lowercase to Uppercase and more, and under Advanced options it can split into Rows instead of columns, useful when one cell holds a list such as red;blue;green.

    Name the parts, drop the rest, fix the type

    Rename column: sku - Copy.1 to category_code
    Remove columns: sku - Copy.2
    Rename column: sku - Copy.3 to product_id
    Change type: product_id to whole number

    In Power BI, Split Column usually adds a Changed Type step by itself and guesses the new columns’ types. Check what it guessed: a code whose leading zeros matter, like a ZIP code, must stay text. Here the zeros are padding, and the product IDs in the model are numbers, so product_id must be a whole number or it will never match.

    Extract: one piece without splitting

    When you need a single piece, Extract is quicker. Transform → Extract replaces the column with the piece; Add Column → Extract puts it in a new column and keeps the original. The options are Length, First Characters, Last Characters, Range, Text Before Delimiter, Text After Delimiter and Text Between Delimiters. The category code is Text Before Delimiter -:

    Add column: category_code = Text.BeforeDelimiter([sku], "-")

    and the product number is the last four characters, converted to a number:

    Add column: product_id = Number.From(Text.End([sku], 4))

    These two lines give the same result as the six steps above, and the checker accepts either. Split is easier to read when you need several pieces; Extract is shorter for one. Both are recorded steps that replay on next month’s file.

    Common mistakes

    • Splitting the only copy. The SKU is gone and Luis’s support team can’t look anything up.
    • Splitting a description by spaces. Dune Black Metal Pendant Light splits into five columns that mean nothing; split codes, not prose.
    • Trusting positions forever. Text.End([sku], 4) works while every number has four digits; splitting at the delimiter keeps working if the partner adds a fifth one next year.

    Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.