Filters and subcubes
Filters and subcubes are not elements of a query but very important concepts, which affect all elements of the queries and are very important for their understanding. Particularly filters have a large influence on the query-design and you should be familiar with their concept.
Filters
A filter can be interpreted as the "current selection" of a dimension, i.e. it determines which elements of a dimension a query, a block, a table or a header currently displays. A filter may contain as many elements of a dimension as desired.
Passing a filter within a query
Filters are passed inside a report from the top to the bottom - starting from the parameters of a query. It will be passed to the selectors, they will pass it (after they changed it) to the outer blocks, then to the inner blocks and so on. Each element of a report can manipulate or limit the filter, particularly selectors and headers in pivot tables have a large influence on the filter.
The start-filter of a reports is either a set of all root elements of all dimensions (like "All products", "All customers" etc.) or influenced by the query-parameters (if the reports was called from another query).
Passing filters inside a query
The filter of each element can be limited with the property filter of the element. Instead of using this property, the usage of the property iteration (which is used to repeat elements) is more common, particularly for headers. E.g. a header could be repeated for each week of a year, in order to produce multiple rows or columns. This iteration has a large influence on the filter, because the filter is limited for each element generated by the iteration and the manipulated filter is passed to the sub-elements of the iterated element.
A special case are the cells, which are the end of the filter chain and are always affected by two headers: By the header in the x axis and by the header in the y axis belonging to the cell. Therefore a cell represents exactly the the part of the data model which is specified by both headers (e.g. if a header with the iteration "Fact:Turnaround" lies on the a x-axis and another header with the iteration "Product:A" on the y-axis, the the cell shows exactly the turnaround for this product "A").
Influence of the filter on properties and formulas
All functions in the properties refer to the current filter the element is generated with. Particularly, if you work with relative functions inside the expressions (e.g with dimension-names or dimension-levelnames), these always refer to the filter.
E.g. a header with an iteration "week" (here "week" should be a level name of the dimension "time") would return all weeks of the current time (independent if that would be one year or one day). The current time is exactly the element (or the elements) from the current filter belonging to the dimension "time".
If you use only a dimension name inside a formula, then this expression returns the elements of this dimension stored in the filter.
Note that you can access, independent of the current filter, all other elements of a dimension in formulas (e.g. if the current filter contains a "Product:A" you still can use a "Product:B" in iterations). Therefore a filter is no access limitation.
Function of the filter property
Almost any element owns a property filter, with which you can limit the filter of its sub-elements. These property accepts expressions which return dimension elements.
These dimension-elements are applied to the filter and all dimensions with at least on element in the result occur are limited to exactly these elements - all other dimension remain uninfluenced by the filter property!
Subcubes
While filters define only the current selection of the dimensions for elements and their properties, you can define real access restrictions for the dimensions with the subcube property. "Real access restrictions" means that no header inside a table has access to the dimension-elements not being part of the subcube. Therefore tables would act as if the dimension would not contain these elements at all.
Subcubes are mostly used to limit dimensions to the interesting part (usually the elements for with present data). E.g. if you want to display pivot-table where only a small part would be filled with data, a subcube is often a good way to limit the dimensions to the part with data.
rows in the chapter Pivot-tables. The functions LOOKUP and DLOOKUP (to find in the "instantOLAP Reference") also also interesting for suppressing blank rows and columns. They are used for searching dimension-elements which provide data for a certain fact and often used in subcubes.
To define a subcube you can use the property "subcube" of a pivot table. This property expects a formula which returns a set of dimension elements. All returned elements form then the new subcube (whereby more than one element for each dimension can be returned) - and all elements, which are not part of the result, do not occur in the subcube (also the facts!). You find a detailed description of the subcube property in the "instantOLAP Reference".
