Fix a query that removes a column before using it (kite shop)
The query trims columns too early, so the Revenue step can't find UnitPrice. Reorder the steps.
- Level
- intermediate
- Time
- ~7 min
- Task
- Fix a broken query
- Access
- Free — no account needed
Loading the practice workspace…
About this exercise
What you'll practise
Read an Expression.Error about a missing column and fix the step order that caused it.
Northwind Kites sells kites and accessories through three regional stores. Orders are exported from the till system every week.
Steps
- The starter query fails with an error that the field
UnitPricewasn't found. - The result should have exactly
OrderID,CustomerandRevenue(= Qty × UnitPrice) for every order. - Calculate Revenue before the step that keeps only the output columns.
Your result must
- The query runs without errors
- Columns: OrderID, Customer, Revenue
- Revenue = Qty × UnitPrice
Input
- Orders (table)
- OrderID: text
- Customer: text
- Region: text
- Product: text
- Qty: number
- UnitPrice: number
- OrderDate: text
- Status: text
Expected output columns
OrderID (text), Customer (text), Revenue (number)
| OrderID | Customer | Revenue |
|---|---|---|
| 0001 | Dmitri Kowal | 55.63 |
| 0002 | Nia Petrov | 117.9 |
| 0003 | Idris Grieve | 24.65 |