The request

From Rachel Ramirez, Merchandise Planner
Your goal
Make sure order_date is a date, add a column line_total = quantity × unit_price, add a column month holding the month number of order_date (4 for April), then keep only the April rows.
- Show exactly
order_idorder_dateproductquantityunit_priceline_totalmonthnot done yet - 12 rowsnot done yet
Your sheet
| order_id | order_date | product | quantity | unit_price | |
|---|---|---|---|---|---|
| 1 | 9093 | 2025-04-02 | Northfield Rattan Sectional | 1 | 229 |
| 2 | 9125 | 2025-04-05 | Northfield Rattan Sectional | 1 | 194.65 |
| 3 | 9198 | 2025-04-11 | Northfield Rattan Sectional | 2 | 229 |
| 4 | 9257 | 2025-04-16 | Northfield Rattan Sectional | 1 | 229 |
| 5 | 9262 | 2025-04-17 | Tidewater Teak Loveseat | 2 | 629 |
| 6 | 9273 | 2025-04-18 | Northfield Rattan Sectional | 1 | 229 |
| 7 | 9284 | 2025-04-19 | Tidewater Teak Loveseat | 1 | 534.65 |
| 8 | 9316 | 2025-04-21 | Northfield Rattan Sectional | 2 | 194.65 |
| 9 | 9338 | 2025-04-24 | Northfield Rattan Sectional | 9 | 229 |
| 10 | 9358 | 2025-04-26 | Northfield Rattan Sectional | 1 | 229 |
| 11 | 9367 | 2025-04-27 | Northfield Rattan Sectional | 1 | 229 |
| 12 | 9369 | 2025-04-27 | Tidewater Teak Loveseat | 1 | 629 |
| 13 | 9417 | 2025-05-02 | Northfield Rattan Sectional | 1 | 229 |
| 14 | 9430 | 2025-05-03 | Northfield Rattan Sectional | 2 | 229 |
| 15 | 9472 | 2025-05-08 | Northfield Rattan Sectional | 2 | 229 |
| 16 | 9490 | 2025-05-09 | Northfield Rattan Sectional | 1 | 229 |
| 17 | 9510 | 2025-05-11 | Northfield Rattan Sectional | 1 | 229 |
| 18 | 9514 | 2025-05-11 | Vale Velvet Loveseat | 1 | 1659 |
| 19 | 9553 | 2025-05-15 | Northfield Rattan Sectional | 1 | 229 |
| 20 | 9559 | 2025-05-15 | Tidewater Teak Loveseat | 1 | 629 |
| 21 | 9631 | 2025-05-21 | Northfield Rattan Sectional | 2 | 229 |
| 22 | 9632 | 2025-05-21 | Tidewater Teak Loveseat | 2 | 629 |
| 23 | 9666 | 2025-05-25 | Northfield Rattan Sectional | 4 | 229 |
| 24 | 9735 | 2025-05-31 | Tidewater Teak Loveseat | 1 | 629 |
| 25 | 9822 | 2025-06-07 | Northfield Rattan Sectional | 4 | 229 |
| 26 | 9824 | 2025-06-07 | Northfield Rattan Sectional | 1 | 229 |
| 27 | 9830 | 2025-06-08 | Northfield Rattan Sectional | 2 | 229 |
| 28 | 9902 | 2025-06-15 | Northfield Rattan Sectional | 2 | 229 |
| 29 | 9904 | 2025-06-15 | Northfield Rattan Sectional | 2 | 229 |
| 30 | 9949 | 2025-06-19 | Northfield Rattan Sectional | 1 | 229 |
| 31 | 9951 | 2025-06-19 | Northfield Rattan Sectional | 4 | 229 |
| 32 | 9979 | 2025-06-21 | Northfield Rattan Sectional | 1 | 229 |
| 33 | 10000 | 2025-06-23 | Northfield Rattan Sectional | 1 | 229 |
| 34 | 10002 | 2025-06-24 | Northfield Rattan Sectional | 1 | 229 |
| 35 | 10026 | 2025-06-26 | Northfield Rattan Sectional | 2 | 194.65 |
| 36 | 10035 | 2025-06-26 | Tidewater Teak Loveseat | 1 | 629 |
| 37 | 10086 | 2025-06-29 | Vale Velvet Loveseat | 3 | 1659 |
| 38 | 10087 | 2025-06-29 | Northfield Rattan Sectional | 2 | 194.65 |
| 39 | 10092 | 2025-06-30 | Northfield Rattan Sectional | 3 | 229 |
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 Rachel gets, and why
The lesson
Most of the columns an analyst wants are not in the export: a line total, the month, a size band. In a worksheet you would write a formula and fill it down. In Power Query you add a custom column: one formula, written once, applied to every row, and replayed on every refresh.
A custom column, row by row
Add column: line_total = [quantity] * [unit_price]
Inside the formula, [quantity] means “this row’s quantity”. There are no cell addresses and no
fill-down: Power Query evaluates the formula for each row. On order 9338, nine Northfield Rattan
Sectionals at 229.00 give 2,061.00. unit_price here is the price paid per unit after any coupon,
which is why some rows show 194.65 instead of 229.
In Excel: Add Column → Custom Column, type the name, double-click columns in the list to insert them, click OK. The formula language is M, which looks a little like Excel but is not the same:
| You want | Excel cell | M custom column |
|---|---|---|
| a column of this row | C2 |
[quantity] |
| multiply | =C2*D2 |
[quantity] * [unit_price] |
| join text | =A2&" "&B2 |
[a] & " " & [b] (text only) |
| a condition | =IF(D2>=500,"big","small") |
if [unit_price] >= 500 then "big" else "small" |
| the month | =MONTH(B2) |
Date.Month([order_date]) |
M is case-sensitive: Date.Month works, date.month doesn’t, and [Quantity] is not
[quantity].
The month from a date
Change type: order_date to date
Add column: month = Date.Month([order_date])
Date.Month returns a whole number from 1 to 12. In real Power Query it only works on a column
whose type is Date: on text it returns an error. That is why the first step sets the type,
even though 2025-04-02 already looks like a date. With the type set, the point-and-click route
opens up: select order_date, Add Column → Date → Month → Month. The same menu has Year,
Name of Month (Date.MonthName, giving April), Day of Week and Start of Month.
Filter to one month
Filter rows: month = 4
The source has 39 lines for April to June 2025. The filter keeps the 12 from April: 23 units and
6,669.60 of revenue. A quick sanity check before you send it: the dates in the result should all
start with 2025-04, and the row count should match what you see when you filter the source by
eye.
You could filter on the date itself instead (Date Filters → In the Previous → Month, or
order_date between April 1 and April 30). Building the month column first has a bonus: the same
column groups the rows by month in a PivotTable later.
The M behind the steps
#"Changed Type" = Table.TransformColumnTypes(Source, {{"order_date", type date}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "line_total", each [quantity] * [unit_price]),
#"Inserted Month" = Table.AddColumn(#"Added Custom", "month", each Date.Month([order_date]), Int64.Type),
#"Filtered Rows" = Table.SelectRows(#"Inserted Month", each [month] = 4)
each is M’s way of saying “for every row”.
Common mistakes
- Filtering on a name the column doesn’t hold.
month = Aprilreturns no rows; the column holds 4. UseDate.MonthNameif you want the word. Date.Monthon a text column. Real Power Query returns an error on every row. Set the type to Date first.- Filtering before building the column.
Filter rows: month = 4as the first step fails: there is no columnmonthyet. Steps run top to bottom. - Typing the column name without brackets.
quantity * unit_priceis not M; columns go in[ ].
Lantern lit!
Practised: power querycustom columndate monthfilter rowsm language
- Solved
- No hints
- First run
