HP Storage Essentials Storage Resource Management Report Optimizer Software 6.0 Performing On-Report Analysis with Web Intelligence (August 2008)

Creating Custom Calculations210
The ForEach context operator
The ForEach operator adds dimensions to a context.
Example: Using ForEach to add dimensions to a context
In the example ”Using In to specify the dimensions in a context” on page 208 you used the
formula:
Max ([Sales Revenue] In ([Year];[Quarter])) In ([Year])
to calculate the maximum revenue by year and quarter in the table, below, which does not
show the Quarter dimension:
Using the ForEach context operator, you can achieve the same result with the formula:
Max ([Sales Revenue] ForEach ([Quarter])) In ([Year])
Why? Because the Year dimension is the default input context in the block (see ”Default
calculation contexts” on page 199 for more information on default contexts). By using the
ForEach operator, you add the Quarter dimension to the context, giving an input context
of ([Year];[Quarter]).
The ForAll context operator
The ForAll context operator removes dimensions from a context.
Example: Using ForAll to remove dimensions from a context
You have a report showing Year, Quarter and Sales Revenue and you want to add a
column that shows the total revenue in each year, as shown in the following block:
To total revenues by year the input context needs to be (Year); by default it is