--- title: "Querying on Travel Expenses" slug: "querying-on-travel-expenses" status: "new" updated: 2026-07-21T20:36:28Z published: 2026-07-21T20:36:28Z canonical: "knowledge.technolutions.net/querying-on-travel-expenses" stale: true --- > ## Documentation Index > Fetch the complete documentation index at: https://knowledge.technolutions.net/llms.txt > Use this file to discover all available pages before exploring further. # Querying on Travel Expenses You can query on trip expenses to review travel costs after a trip, compare expenses by trip component, or calculate cost per attendee. Expenses may be associated with trips, stops, forms, events, interviews, and Scheduler slots, so the query structure depends on the level of detail you need. Use the **Expense** base when you need one row per expense. Use the **Trip** base when you need one row per trip with aggregate totals. > [!TIP] > ⭐ Get Inspired > > This article was adapted from [a post by Technolutions staff](https://community.technolutions.net/get-inspired/post/creating-a-post-travel-query-w-travel-expenses-from-trips-cZ4NWGt1tmxXyI2) in the Slate Community Forums' Get Inspired space. Have a great idea for a Get Inspired post? [Let us know](https://community.technolutions.net/get-inspired/new?post_type=gnHx7As1gZ8r6Ld)! ## Review expense data on the trip The trip's **Expenses** tab shows expenses associated with the trip and related records. The **Record** column indicates whether an expense is associated with the trip, a stop, a Scheduler appointment, or an event. ![Trip Expenses tab showing expense records and associated record types](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/01-HxxhkqttVxjBpVWlcY41o.webp) > [!NOTE] > 💡 Tip > > If you only need a trip expense report for review or reimbursement, use **Print Expenses** from the trip. Build a query when you need filtering, reporting, totals across trips, or ROI-style calculations. ## Build a trip expense summary query 1. Go to **Queries / Reports**. 2. Create a Configurable Joins query on the **Trip** base. 3. Add filters to return the relevant trip, trip folder, date range, or user. 4. Add exports such as trip name, start date, stop date, assigned user, and folder. ## Export trip activity details Add subquery exports for the trip components you want to review alongside expenses. ### Flights and stops 1. Add a subquery export. 2. Join to **Trip Stops**. 3. Filter by stop type, such as **Flight**, when you need one type of stop. 4. Add exports for the stop details you need. ![Subquery export joined from Trip to Trip Stops for flight details](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/02-Yd4bFSoKMGPDj91sjBt2q.webp) ### Events and Scheduler appointments 1. Add a subquery export. 2. Join to **Forms**. 3. Use the form or event type when you need to separate events from Scheduler appointments. 4. Add exports such as title, type, start date, location, registrant count, or assigned user. ![Subquery export joined from Trip to Forms for events or Scheduler appointments](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/03-XHiZ48iQXdLYmdAV4TK7d.webp) ## Calculate trip expense totals ### Expenses associated directly with the trip 1. Add a subquery export. 2. Join to **Expenses**. 3. Set **Output** to **Aggregate**. 4. Set **Aggregate** to **Sum**. 5. Export the expense amount. ![Subquery export that sums expenses associated directly with a trip](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/04-yTWuSxiHOPsgsMc3fNtIy.webp) ### Expenses associated with trip events or Scheduler appointments 1. Add a subquery export. 2. Join to **Forms**. 3. From Forms, join to **Expenses**. 4. Set the output to an aggregate sum of the expense amount. ![Subquery export that sums expenses associated with trip forms or appointments](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/05-H3MCHcA0H0xfNSyYuL65Y.webp) ### Expenses associated with trip stops If your database does not expose a direct join from Trip Stops to Expenses in the needed context, use an independent Expense subquery and a nested filter that compares the expense record reference to the trip stop GUID. 1. Add a subquery export. 2. Set **Type** to **Independent Subquery**. 3. Set **Category** to **Related** and **Base** to **Expense**. 4. Set **Output** to **Aggregate** and **Aggregate** to **Sum**. 5. Export the expense amount. 6. Select **Display SQL** and identify the expense table alias, such as `exp_...`. 7. Reopen the subquery export and add a nested subquery filter joined to **Trip Stops**. 8. Export **Trip Stops GUID**, set the aggregate to **Formula**, and compare the trip stop GUID to the expense record reference. ```sql @Trip-Stops-GUID = expensealias.[record] ``` ![Display SQL popup showing the expense table alias](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/06-pp3cJvBpTJFnT8zUstVc7.webp) ![Nested subquery filter comparing a trip stop GUID to an expense record reference](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/07-8hLjrwJULaTzQbLMl3XLL.webp) > [!WARNING] > 📝 Note > > Table aliases from **Display SQL** are generated by the query. If you rebuild the subquery, confirm the alias before relying on the formula. ## Combine totals and calculate cost per attendee To report total trip cost, create a formula subquery export that adds the relevant nested expense totals together. ![Formula subquery export that combines multiple trip expense totals](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/08-sdwgnPBVufFLvAcvWJOti.webp) To calculate cost per attendee, divide the total trip expense amount by a count of attendees for events and Scheduler slots associated with the trip. ![Formula subquery export that calculates trip cost per attendee](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/09-BJ6Xz2U4GxPnPIjc0dVZ8.webp) ## Review the query output Run the query and confirm that the result returns the expected trip details, expense totals, and cost calculations. Compare the query totals against the trip's Expenses tab or printed expense report before using the results for analysis. ![Query results showing a post-travel expense report](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/10-eJdx4c1q6RXuEyIvWwsJt.webp) ## Related articles - [Expense Management](https://knowledge.technolutions.net/docs/expense-management) - [Create a Trip](https://knowledge.technolutions.net/docs/create-a-trip) - [Subquery Exports & Outputs](https://knowledge.technolutions.net/docs/subquery-exports-outputs) - [Using Formulas in Queries](https://knowledge.technolutions.net/docs/using-formulas-in-queries)