Skip to main content

Analyze Sample Orders in a Notebook

Start with 12 fictional service orders. Load the file into a table, query it in a notebook, and calculate the change in revenue in Python. The same table feeds the Data Flows tutorial and the Dashboards tutorial.

Load the sample table​

You need access to Studio, a warehouse with query access, and an existing catalog and schema where you may create a tutorial table. You can complete the SQL checks in the SQL editor if a Python notebook runner is unavailable.

  1. Download studio-orders.csv. It contains one row per order for January and February of 2025 and 2026.
  2. Open Upload, select the CSV, and wait for the file to finish uploading. Open Load into table for that file.
  3. Preview the file with the first row treated as headers. Choose Create new table and enter a fully qualified name such as your_catalog.your_schema.studio_orders. Use a unique name if the table already exists.
  4. Review the inferred types. order_date should be a date, region and service should be text, and order_id, report_year, revenue, and profit should be numeric. Confirm the load result shows 12 rows.

Use your own qualified table name wherever the snippets show your_catalog.your_schema.studio_orders.

Create and run the notebook​

  1. Open Notebooks and choose New notebook. Name it Service orders review.
  2. Add a Markdown cell with the title Service orders review and a note that both periods cover January and February.
  3. Add a SQL cell below it and run the query:
SELECT report_year,
COUNT(*) AS order_count,
SUM(revenue) AS total_revenue,
SUM(profit) AS total_profit
FROM your_catalog.your_schema.studio_orders
GROUP BY report_year
ORDER BY report_year;
YearOrdersRevenueProfit
20256$5,250$1,150
20266$7,000$1,550
  1. Add a Python cell immediately below the SQL cell. The notebook exposes the latest SQL result as _sqldf:
revenue = _sqldf.set_index('report_year')['total_revenue'].astype(float)
prior = revenue.loc[2025]
current = revenue.loc[2026]
print(f'Revenue change: ${current - prior:,.0f}')
print(f'Percentage change: {(current / prior - 1):.1%}')

Expect Revenue change: $1,750 and Percentage change: 33.3%.

  1. Choose Save, then Run all. In Runs, open the finished run and check that its Python output matches the interactive result.

If a result differs​

What you seeWhat to check
Table or schema missingConfirm the qualified name, connection, and grants. Check that the upload finished loading into a table.
SQL returns more than 12 source rowsConfirm you used Create new table for the fixture. Use a fresh qualified name if you appended the sample more than once.
Python cannot find _sqldfRun the SQL cell successfully before Python, or use Run all with the cells in order.
report_year cannot be found in PythonInspect the SQL result column names and confirm the Python cell follows the intended query.

Next, build a regional revenue flow to turn the same orders into a reusable comparison.