You can refer to a cell on a different sheet and use its content in a calculation.
Prerequisite
A table view is created for the query or the ad-hoc analysis.
Procedure
Start the query or the ad-hoc analysis.
Click Output if the table is hidden.
Enter the relevant formula with a reference to the other sheet, for example, SUM.
Enter the reference to the other sheet in the following form:
=SUM('Sheet name'!Cell:Cell).
The values from the sheet defined in the formula are used for the calculation.
Example
The relevant values for the calculation are located on sheet 1:
The calculation is carried out on sheet 2: