BAQ subquery in a from clause

Hello all,
I need to do a sum on qty on hand for parts across all bins before I perform a join. Is it possible to create a query and add it in as a subquery in a from clause? Or there another way to handle this using BAQs? Attached is a screenshot of a manually written query of the functionality I am looking for. The subquery is in between the comment syntax.

Just do a subwuery with the aggregate and then bring it into the main query and join just like you did in the sample