1. Lighthouse

Level 4 · A lean import that folds

The request

From Eric Sullivan, Operations Manager

“The shipping report imports every column of every order, and the refresh is the slowest in the company. I report completed orders by day, channel and shipping fee. Nothing else. Can you trim the import to that?”

Your goal

The Source step is the orders table for 29–31 December 2025 as imported from SQL Server, with order_date as a full timestamp. Keep only completed orders, keep only order_id, order_date, channel and shipping_fee (in that order), and turn order_date into a date with no time.

  • Show exactly order_id order_date channel shipping_feenot done yet
  • 22 rowsnot done yet

Your query steps

Power Query
The sheet for this level
order_idcustomer_idorder_datestatuschannelshipping_feecoupon_code
11294718112025-12-29 07:07:30pendingapp0
21294817352025-12-29 07:40:14pendingapp0
31294919902025-12-29 11:29:26pendingweb6.95WELCOME10
4129501922025-12-29 12:24:25completedweb0
51295110572025-12-29 12:33:38pendingweb0
6129524822025-12-29 12:37:52completedapp0
71295316992025-12-29 13:31:47completedapp0
8129547862025-12-29 13:43:21pendingapp0
9129557762025-12-29 17:51:54pendingweb49
10129562732025-12-29 19:10:20completedweb0
111295719912025-12-29 19:28:00completedweb0WELCOME10
12129586152025-12-29 20:14:58completedweb0
13129592282025-12-29 21:15:25pendingapp0
141296016352025-12-29 23:31:07pendingweb6.95
151296112772025-12-30 01:08:31pendingweb0
161296215542025-12-30 08:52:37pendingweb0WELCOME10
171296317482025-12-30 10:27:31pendingweb0
181296411002025-12-30 11:19:15pendingapp0FREESHIP
191296510122025-12-30 13:18:34completedweb0
201296614322025-12-30 14:16:55pendingmarketplace4.99
21129672612025-12-30 15:23:42pendingmarketplace4.99
22129689942025-12-30 15:30:06completedapp0
231296914782025-12-30 17:06:57completedweb0
24129704512025-12-30 18:45:43completedweb0
25129714312025-12-30 19:19:43pendingmarketplace4.99
26129728192025-12-30 19:19:50completedmarketplace4.99
27129737852025-12-30 20:09:11pendingapp6.95
281297410322025-12-30 21:12:04pendingweb0
291297519812025-12-30 21:12:55pendingapp0
301297617012025-12-31 05:18:13pendingweb6.95
311297713212025-12-31 05:29:21pendingapp6.95
321297815372025-12-31 07:20:15completedapp0
33129796152025-12-31 07:30:51completedmarketplace4.99
341298019892025-12-31 08:12:13completedapp0
351298113552025-12-31 08:36:52pendingweb0
361298212482025-12-31 08:52:31pendingweb6.95
37129838622025-12-31 10:05:49completedapp0
381298410632025-12-31 10:52:35pendingweb0
39129859782025-12-31 11:34:21pendingweb0
401298618542025-12-31 13:20:34completedapp0
411298710122025-12-31 13:41:59completedweb0
421298813442025-12-31 13:58:30pendingweb0
431298918722025-12-31 17:15:21completedapp0
441299016342025-12-31 18:13:59completedapp0
451299117212025-12-31 18:17:06pendingweb6.95
46129927822025-12-31 18:35:50pendingapp0
471299316142025-12-31 18:40:37completedapp0WELCOME10
481299419552025-12-31 18:46:24completedapp0
491299512832025-12-31 19:11:51completedapp0
50129965782025-12-31 19:21:13pendingweb0
51129976512025-12-31 20:32:59pendingmarketplace4.99
52129984912025-12-31 21:20:47pendingweb6.95
531299919982025-12-31 21:59:03pendingapp6.95WELCOME10
54130006012025-12-31 23:23:56pendingweb0

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

    The cheapest data is the data you never import. Every column you load is compressed, stored and scanned on every refresh; every row of a cancelled order is one more row someone has to filter out in DAX later.

    What you are working in

    This page is a practice editor for Power Query’s way of working, not Power Query itself. The Source step holds the imported table; you add steps one per line, and the preview shows the result after each step. Step names and results match Power Query’s.

    In Power BI Desktop: Home → Transform data opens the Power Query Editor. Filter with the arrow on the status header (untick everything but completed), keep columns with Home → Choose Columns, and change the type with the icon left of the order_date header → Date. Finish with Home → Close & Apply.

    The three steps

    Filter rows: status = completed
    Choose columns: order_id, order_date, channel, shipping_fee
    Change type: order_date to date

    The order matters for two reasons. You can’t filter on status after you have removed it. And in Power Query, steps that can be sent back to the source should come first.

    Query folding

    When the source is a database, Power Query tries to translate your steps into one query in the source’s language. This is query folding: the filter becomes a WHERE, Choose columns becomes the SELECT list, and the type change becomes a CAST. SQL Server does the work, and only the rows and columns you keep cross the network into Power BI.

    Folding stops at the first step the source can’t express (many custom columns, some text functions, merging with an Excel file, adding an index column). Every step after that runs inside Power Query on the whole table it received. So put the steps that fold, above all filters and column choices, at the top, and the ones that don’t at the end.

    To check, right-click a step in Applied Steps: if View Native Query is available, that step folds; if it is greyed out, folding stopped at or before it. Newer versions also show folding indicators next to each step.

    Why a date and not a timestamp

    A timestamp to the second has a different value on nearly every row, and VertiPaq compresses columns by their distinct values. The report needs days, so keep days: about 1,100 values for three years instead of hundreds of thousands. If someone later wants the hour, add an hour column, not the full timestamp.

    Do it at the source when you can

    Heavy shaping, such as joins of big tables or history going back years, is cheaper in a database view or the data warehouse than in Power Query. Power Query is best for light, foldable trimming. For large fact tables, incremental refresh (right-click the table in Desktop → Incremental refresh) reloads only the recent days on each refresh.

    Common mistakes

    • Removing columns instead of choosing them. New source columns sneak in later.
    • Filtering in the report. A visual filter hides rows; the model still stores them.
    • A non-folding step first. Everything after it runs on the full table.

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