1. Lighthouse

Level 8 · Boss: two messy exports, one clean table

The request

From Laura Bennett, Head of Finance

“The marketplace sends a weekly sales file and I've got the last two. Everything in them is text, the category is typed every which way, and their weeks run Sunday to Sunday, so November 2 is in both files. I need one clean table: revenue and units by category for the two weeks together, every line counted once.”

Your goal

Step 1 of 3. Append Marketplace_Wk45 under this week's rows, then remove duplicate order lines by order_item_id, so November 2 is counted once.

  • Show exactly order_item_id order_date category quantity amountnot done yet
  • 80 rowsnot done yet

Step 1 · your query steps

Power Query
The sheet for this level
order_item_idorder_datecategoryquantityamount
1264902025-10-28DECOR4175.96
2264912025-10-28Decor239.98
3264922025-10-28lighting2378.00
4265052025-10-28Kitchen 153.99
5265062025-10-28KITCHEN170.99
6265292025-10-29Lighting 2698.00
7265492025-10-30Outdoor 150.99
8265502025-10-30DECOR117.99
9265662025-10-30LIGHTING1189.00
10265672025-10-30Decor117.99
11265682025-10-30kitchen3116.97
12265912025-10-31Kitchen19.89
13266132025-11-01Furniture 1519.00
14266142025-11-01DECOR1179.00
15266152025-11-01Decor471.96
16266162025-11-01decor231.98
17266172025-11-01Decor 359.97
18266182025-11-01LIGHTING91791.00
19266192025-11-01Textiles6509.94
20266202025-11-01textiles255.98
21266252025-11-01Decor 3134.97
22266592025-11-02Furniture2358.00
23266702025-11-02DECOR347.97
24266712025-11-02Kitchen113.99
25266722025-11-02kitchen443.96

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.

    Step 2 · your query steps

    Power Query
    The sheet for this level
    order_item_idorder_datecategoryquantityamount
    1264902025-10-28DECOR4175.96
    2264912025-10-28Decor239.98
    3264922025-10-28lighting2378.00
    4265052025-10-28Kitchen 153.99
    5265062025-10-28KITCHEN170.99
    6265292025-10-29Lighting 2698.00
    7265492025-10-30Outdoor 150.99
    8265502025-10-30DECOR117.99
    9265662025-10-30LIGHTING1189.00
    10265672025-10-30Decor117.99
    11265682025-10-30kitchen3116.97
    12265912025-10-31Kitchen19.89
    13266132025-11-01Furniture 1519.00
    14266142025-11-01DECOR1179.00
    15266152025-11-01Decor471.96
    16266162025-11-01decor231.98
    17266172025-11-01Decor 359.97
    18266182025-11-01LIGHTING91791.00
    19266192025-11-01Textiles6509.94
    20266202025-11-01textiles255.98
    21266252025-11-01Decor 3134.97
    22266592025-11-02Furniture2358.00
    23266702025-11-02DECOR347.97
    24266712025-11-02Kitchen113.99
    25266722025-11-02kitchen443.96

    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.

      Step 3 · your query steps

      Power Query
      The sheet for this level
      order_item_idorder_datecategoryquantityamount
      1264902025-10-28DECOR4175.96
      2264912025-10-28Decor239.98
      3264922025-10-28lighting2378.00
      4265052025-10-28Kitchen 153.99
      5265062025-10-28KITCHEN170.99
      6265292025-10-29Lighting 2698.00
      7265492025-10-30Outdoor 150.99
      8265502025-10-30DECOR117.99
      9265662025-10-30LIGHTING1189.00
      10265672025-10-30Decor117.99
      11265682025-10-30kitchen3116.97
      12265912025-10-31Kitchen19.89
      13266132025-11-01Furniture 1519.00
      14266142025-11-01DECOR1179.00
      15266152025-11-01Decor471.96
      16266162025-11-01decor231.98
      17266172025-11-01Decor 359.97
      18266182025-11-01LIGHTING91791.00
      19266192025-11-01Textiles6509.94
      20266202025-11-01textiles255.98
      21266252025-11-01Decor 3134.97
      22266592025-11-02Furniture2358.00
      23266702025-11-02DECOR347.97
      24266712025-11-02Kitchen113.99
      25266722025-11-02kitchen443.96

      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

        This boss level is the whole chapter in one query: two raw files in, one clean table out, every step recorded so the next file costs one click. As in the rest of the chapter, you work in the practice editor, not Power Query itself; each step’s starter carries the steps you’ve already written, the way Applied Steps grow in Power BI.

        The files

        Both exports have the same five columns: order_item_id, order_date, category, quantity and amount, all text. Marketplace_Wk44 (the Source) covers October 27 to November 2, 25 lines; Marketplace_Wk45 covers November 2 to 9, 59 lines. The category is typed four ways: Lighting, lighting, LIGHTING and Lighting with a trailing space.

        Step 1: one table, each line once

        Append queries: Marketplace_Wk45
        Remove duplicates: order_item_id

        In Power BI: select the first query, Home → Append Queries (or Append Queries as New to leave both untouched), pick the second. Append matches columns by name; a column only one file has is filled with null in the other’s rows. For a folder of weekly files, Get data → Folder followed by Combine & Transform does the appending for you on every refresh.

        Then select order_item_id and Home → Remove Rows → Remove Duplicates. Power Query keeps the first row of each order_item_id. Choosing the key column matters: removing duplicates across all columns would keep both copies of a line the marketplace had corrected between files.

        Step 2: types and text

        Change type: order_item_id, quantity to whole number
        Change type: amount to decimal
        Change type: order_date to date
        Trim: category
        Capitalize each word: category

        In Power BI, select columns and use Transform → Data Type, then Transform → Format → Trim and Capitalize Each Word. Look at View → Column quality after the type changes: 0% errors in every column means every value converted. If amount had used a comma as decimal separator, you’d change it Using Locale instead of replacing characters by hand.

        Step 3: the summary

        Group by: category | revenue = sum of amount | units = sum of quantity
        Sort rows: revenue descending

        Home → Group By → Advanced, two aggregations (Sum of amount, Sum of quantity), then sort revenue descending.

        Load it

        Home → Close & Apply runs the query and loads the result into the model; from then on, Home → Refresh in Report view replays every step on the current files. Right-click the two weekly queries → untick Enable load, so only the clean table reaches the model and the raw files stay as inputs.

        What it shows

        Lighting leads the fortnight with $5,148 from 32 units, almost twice Furniture’s $2,732, which took only 8 units: marketplace furniture orders are rare but large. Decor sold the most units, 49, for $1,541. Revenue and units tell different stories, so Laura gets both side by side.

        Common mistakes

        • Appending after cleaning only the first file: the second file’s text never gets fixed. Append first, clean once.
        • Removing duplicates before appending: each file has no duplicates on its own; the overlap only appears once they’re stacked.
        • Grouping on the raw category: lighting and LIGHTING stay separate rows.

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