Watch this video to learn about the subqueries.
To resolve this problem, use a subquery. Begin by creating a query using the Store name and Sales revenue objects. Then choose Add a subquery.
By default, the Sales revenue object appears in the subquery definition in the Query Filters panel. To display the results for all stores with sales revenue greater than or equal to the sales revenue of the Chicago 33rd location in your report, change the operand in the subquery to Greater than or Equal to. Then drag the Store name dimension to just below the subquery filter definition to complete the subquery.
Use the following syntax:
Store name Equal to e-Fashion Chicago 33rd
When you run the query, the report returns the results for the Chicago 33rd store, as well as results for all the other stores with equal or greater sales revenue than the revenue of the Chicago 33rd store.
Procedure: To Build a Subquery
Follow these steps to build a subquery:
- Include the objects that you want to appear in the query to the Result Objects panel.
- Select the object that you want to filter with a subquery.
- In the Query Filters panel, choose Add a Subquery.
The Subquery outline appears in the Query Filters panel.
- To add a Where condition to the subquery, move an object to the To Filter the Query area.
- Select an operator and values to filter the object in the Where condition.
- To use a standard query filter as a Where condition in a subquery, move the existing filter or subquery to the To Filter the Query area
- To copy rather than move the existing filter to the Where condition, use the Ctrl key while you move the object. In this way, the existing filter remains in its place and also becomes part of the Where condition of the subquery.
- To add an additional subquery to the query filter, choose Subquery.
- To nest a subquery within another subquery, move an existing subquery to the Query Filter panel. In this way, the subquery becomes a part of the Where condition of the outer subquery.
- To change the relationship between the queries from And to Or, choose the And operator.