EVERY |
The EVERY function returns YES when every value of a Boolean expression is TRUE, or NO when any value of the expression is FALSE.
Return Value
BOOLEAN
Syntax
EVERY(boolean-expression [dimensions])
Arguments
The Boolean expression whose values are to be evaluated.
The dimensions of the result. By default, EVERY returns a single value. When you indicate one or more dimensions for the results, EVERY tests for TRUE values along the dimensions that are specified and returns an array of values. Each dimension must be either a dimension of boolean-expression or related to one of its dimensions. When it is a related dimension, you can specify the name of the relation instead of the dimension name. This enables you to choose which relation is used when there is more than one.
When boolean-expression is dimensioned by dimension of type DAY, WEEK, MONTH, QUARTER, or YEAR, you can specify any other DAY, WEEK, MONTH, QUARTER, or YEAR dimension as a related dimension. Oracle OLAP uses the implicit relation between the dimensions. For each time period in the related dimension, Oracle OLAP tests the data values for all the source time periods that end in the target time period. This method is used regardless of which dimension has the more aggregate time periods. To control the mapping of one DAY, WEEK, MONTH, QUARTER, or YEAR dimension to another (for example, from weeks to months), you can define an explicit relation between the two dimensions and specify the name of the relation as the dimension argument.
Notes
The Effect of NASKIP on EVERY
EVERY is affected by the NASKIP option. When NASKIP is set to YES (the default), EVERY ignores NA values and returns YES when every value of the expression that is not NA is TRUE and returns NO when any values are not TRUE. When NASKIP is set to NO, EVERY returns NA when any value of the expression is NA. When all the values of the expression are NA, EVERY returns NA for either setting of NASKIP.
Examples
Testing for All-True Values by District
You can use the EVERY function to test whether each district's sales of sportswear have exceeded $50,000 in every month. To have the results dimensioned by district, specify district as the second argument to EVERY.
LIMIT product TO 'Sportswear' REPORT HEADING 'Top Sales' EVERY(sales GT 50000, district)
The preceding statements produce the following output.
DISTRICT Top Sales -------------- ---------- Boston No Atlanta Yes Chicago Yes Dallas Yes Denver Yes Seattle NO
Testing for All-True Values by Region
You might also want to find out the regions for which every district has sportswear sales that exceed $50,000 in every month. Since the region dimension is related to the district dimension, you can specify region instead of district as a dimension for the results of EVERY.
REPORT HEADING 'Top Sales' EVERY(sales GT 50000, region)
The preceding statement produces the following output.
REGION Top Sales -------------- ---------- East No Central Yes West NO