1. Lighthouse

Level 4 · Band orders by size and add the month

The request

From Nicole Turner, Business Accounts Manager

“I'm preparing the yearly review with one of our biggest business customers, Justin Richardson's design studio in Cincinnati. I want their 2025 orders sorted into Large (1,000 dollars and up), Medium (250 up to 1,000) and Small, and the month name on each order so I can talk about their busy season.”

Your goal

The Source step is the account's 34 completed orders from 2025, with order_date as text. Change order_date to a date, add size_band ("Large" when subtotal is 1000 or more, "Medium" when it is 250 or more, otherwise "Small"), and add month with the month's full name (e.g. January).

  • Show exactly order_id order_date channel subtotal size_band monthnot done yet
  • 34 rowsnot done yet

Your query steps

Power Query
The sheet for this level
order_idorder_datechannelsubtotal
184722025-01-26app905
285532025-02-04app157.94
387252025-02-25app131.93
487772025-03-03web3927.77
589342025-03-17app1606.42
690812025-04-01web1045.37
791872025-04-10web440.98
894282025-05-03marketplace2861.92
995432025-05-14marketplace748.92
1096222025-05-20app1301.93
11100782025-06-29web1577.49
12101742025-07-09web776.82
13101932025-07-10app769.99
14102212025-07-13app498
15102422025-07-15web582.93
16105512025-08-12web10550.87
17108232025-09-03app463.8
18110492025-09-25marketplace1997.98
19111222025-09-29app773.85
20112572025-10-11web889.91
21114192025-10-25marketplace543.9
22114992025-10-31web193.95
23117982025-11-15app525.95
24118532025-11-18web235.89
25119112025-11-20marketplace1132.9
26119402025-11-22app260.92
27119482025-11-22app473.93
28120272025-11-26web70.99
29121452025-11-29app1387.37
30124002025-12-06app200.97
31124602025-12-08web759.97
32125532025-12-12web1757.88
33129292025-12-28app833.83
34129722025-12-30marketplace389.85

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

    Nicole doesn’t want 34 numbers; she wants three groups and a calendar. That is two new columns, one built from a rule and one taken from the date.

    Change the date first

    Change type: order_date to date

    Date functions need a date. In Power BI, click the ABC icon on the header and pick Date. If the text is in another format than your locale expects (03/04/2025 from a European system), use Change Type → Using Locale and pick the source’s locale, so March and April don’t swap.

    A conditional column

    In Power BI: Add Column → Conditional Column. The dialog builds the rule in rows:

    Column name Operator Value Output
    If subtotal is greater than or equal to 1000 Large
    Else If subtotal is greater than or equal to 250 Medium
    Else Small

    Name it size_band at the top. Power Query turns the dialog into one M expression, which is what you write here:

    Add column: size_band = if [subtotal] >= 1000 then "Large" else if [subtotal] >= 250 then "Medium" else "Small"

    The tests run from the top and stop at the first one that is true, so order matters: put the biggest threshold first. The M step it records:

    Table.AddColumn(#"Changed Type", "size_band",
        each if [subtotal] >= 1000 then "Large" else if [subtotal] >= 250 then "Medium" else "Small")

    When the rule needs more than one column (and, or) or arithmetic, use Add Column → Custom Column and type the expression yourself. M is case-sensitive: if, then, else are lower case, and text goes in double quotes.

    Parts of a date

    Select order_date, then Add Column → Date for a menu of pieces: Year, Month (with Month, Name of Month, Start of Month and more), Quarter, Week, Day (with Name of Day), Age. Name of Month records:

    Add column: month = Date.MonthName([order_date])

    Other useful ones: Date.Year([order_date]), Date.Month([order_date]) (1 to 12, the number you sort month names by), and Date.Day. Transform → Date offers the same pieces but replaces the column instead of adding one.

    Power Query or DAX?

    You could write the band as a DAX calculated column too. A rule that depends only on one row’s values, like this one, is usually better in Power Query: it’s computed once at refresh and compresses well. Keep DAX for logic that depends on filters, such as “Large compared with this customer’s average”.

    What it shows

    Eleven of the 34 orders are Large, and they bring in about 71% of the account’s money; one August order alone is over $10,500. November is the busiest month, with seven orders.

    Common mistakes

    • Thresholds in the wrong order. The first true test wins.
    • Gaps or overlaps. > 250 in one test and < 250 in the next leaves exactly 250 in no band; >= then else covers every value once.
    • Month names without month numbers. Sorted alphabetically, April comes first. In the model, sort the name by the number (Column tools → Sort by column).

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