The Working Set
As a technical aside, you might be interested in knowing about the working set. For Spectre, and even ProDiver, the working set is the set of detail records that are being processed. The process of diving groups detail records by dimension values to get a working set. Normally, when you dive, this is the set of records matching the Dimension values for the output rows. For example, in a dive on <Sales Region, Product Family>, the set of records with <North, Cheese> go to one output row, <North, Butter> another, and so on. Each output row results from processing multiple rows in the working set. This is the standard processing that creates the set of detail records that are input to summary functions like add() or max().
With Spectre, however, you can change the working set while running a calculation.
Here are examples of changing the working set by using the parent(), top(), and filter() functions:
- parent(<expression>)—Runs the expression over all the detail records in the initial window. This is equivalent to using the totals row before performing dives to narrow down the working set. For example:
- parent(sum(value("Units")))
- could be used in part to compute a percent of total for the row in the current window.
- top(<expression>)—Runs the expression over all the detail records in the data source (after access control and cPlan filters, but before Dive filters). For example:
- top(max("Date"))
- could be used to calculate the most recent date in the cBase.
- filter(<expression>,<function>)—Filters the current working set by using the function, then runs the expression. For example:
- filter(average(value("Profit")), value("SalesPerson")="Bob")
- could be used to find rows for Bob, then calculate the average profit.