Anchor | ||||
---|---|---|---|---|
|
Table of Contents | ||
---|---|---|
|
Overview
Sub queries permit as user to generate far more sophisticated reports. For example if you wanted to compare the sales results of this financial year with past years you may wish to use an append query or if you wanted to determine which customers were new in a particular year you would use a minus query. In both these examples Yellowfin is generating two distinct queries and then combining the result set to provide you with a single table of results. With Yellowfin you can create 4 types of sub query, these are:
...
- Firstly you will need to create a query that returns the revenue for a selected period by country. Country, Sum Invoiced Amount and Year in the filter
- Now select the sub query option and choose append. You will see a very similar query builder to the standard builder. In the fields section you will have to replicate the attributes of your original query so that the same level of aggregation can occur.
- The join will have to be specified for the sub query. In the join section click the refresh link to display the available join fields. You will have to link the fields on the master query with the fields on the sub query.
Note: you do not have to include metric fields. - Once you have matched the fields click the add icon to add the join to the list.
- Now return to your master query. You should see additional attributes in the fields list. Note they are prefixed by sub query: and cannot be removed from the list of fields.
- The final step is to set the filters. Progress to the filters page. You will see that similar to the data page you have a tabbed set of filter attributes. Set the filter value for each filter for the specific periods required.
- When you now run the report you will have two columns one for each period specified. If required you can also created calculated fields to determine the difference between the two values. This would be done on the master query by creating calculated fields in the standard way.
...
- Firstly you will need to create a query that returns a list of customers that took part in Year 2. Athlete ID, First Name, Last Name and Year in the filter.
Note: some of these may not have purchased in Year 1. - Now select the sub query option and choose Intersect. You will see a slightly different interface to the normal query builder. The purpose of this is to select a linked field or key in the master query and determine which filters you which to apply. In this example we want to link on the athlete id and filter it by year 1.
- The final step is to set the filters. Progress to the filters page. You will see that similar to the data page you have a tabbed set of filter attributes. Set the filter value for each filter for the specific periods required.
...
See Advanced Sub Query Tutorial for more information.