Skip Headers
Oracle® OLAP Expression Syntax Reference
Release 11.2

Part Number E23381-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub
OLAXS199

COUNT

COUNT tallies the number of data values identified by a selection of members in a Time dimension.

The GREGORIAN relations superimpose the Gregorian calendar on the Time dimension. These relations can be useful for calculations on fiscal and nonstandard hierarchies.

Return Value

NUMBER

Syntax

COUNT (value_expr) OVER (window_clause)

window_clause::=

{ DIMENSION dimension_id | HIERARCHY hierarchy_id }
  BETWEEN preceding_boundary AND following_boundary 
   [WITHIN { LEVEL
            | PARENT
            | GREGORIAN {YEAR | QUARTER | MONTH | WEEK}
            | ANCESTOR AT { DIMENSION LEVEL dim_level_id
                           | HIERARCHY LEVEL hier_level_id 
                           }
            }
   ]

preceding_boundary::=

{UNBOUNDED PRECEDING | expression PRECEDING} AND 
   { CURRENT MEMBER 
   | expression {PRECEDING | FOLLOWING}
   | UNBOUNDED FOLLOWING
   }

following_boundary::=

{CURRENT MEMBER | expression FOLLOWING} AND
  { expression FOLLOWING 
  | UNBOUNDED FOLLOWING
  }

Arguments

OLAXS200value_expr

A dimensional expression whose values you want to calculate.

OLAXS201dimension_id

The Time dimension over which the values are calculated using the default hierarchy.

OLAXS202hierarchy_id

The hierarchy over which the values are calculated. If dimension_id is used instead, the default hierarchy is used.

OLAXS203dim_level_id

The name of a level of dimension_id.

OLAXS204hier_level_id

The name of a level of hierarchy_id.

OLAXS205boundaries

The preceding_boundary and following_boundary identify a range of time periods within the group identified by the dimension or hierarchy.

UNBOUNDED starts with the first period or ends with the last period of the group.

CURRENT MEMBER starts or ends the calculation at the current time period.

OLAXS206expression

A numeric value identifying a period at a particular distance from the current time period that starts or ends the range.

OLAXS207WITHIN subclause

Identifies the range of time periods used in the calculation. Following are descriptions of the keywords.

Range Description
LEVEL Calculates all time periods at the same level. (Default)
PARENT Calculates time periods at the same level with the same parent.
GREGORIAN YEAR Calculates time periods within the same Gregorian year.
GREGORIAN QUARTER Calculates time periods within the same Gregorian quarter.
GREGORIAN MONTH Calculates time periods within the same Gregorian month.
GREGORIAN WEEK Calculates time periods within the same Gregorian week.
ANCESTOR Includes time periods at the same level and with the same ancestor at a specified level.

Example

This example tallies the number of time periods at the same level and the same year up to and including the current time period. The selected data displays the number of each month in the year.

COUNT(GLOBAL.UNITS_CUBE.UNITS) OVER (HIERARCHY GLOBAL.TIME.CALENDAR BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER WITHIN ANCESTOR AT DIMENSION LEVEL GLOBAL.TIME.CALENDAR_YEAR)

TIME UNITS COUNT
JAN-06 47776 1
FEB-06 47695 2
MAR-06 51348 3
APR-06 47005 4
MAY-06 52809 5
JUN-06 45419 6
JUL-06 48388 7
AUG-06 48830 8
SEP-06 46354 9
OCT-06 47411 10
NOV-06 46842 11
DEC-06 55052 12

Related Topics

AVG, MAX, MIN, SUM

Reader Comment

   

Comments, corrections, and suggestions are forwarded to authors every week. By submitting, you confirm you agree to the terms and conditions. Use the OTN forums for product questions. For support or consulting, file a service request through My Oracle Support.

Hide Navigation

Quick Lookup

Database Library · Master Index · Master Glossary · Book List · Data Dictionary · SQL Keywords · Initialization Parameters · Advanced Search · Error Messages

Main Categories

This Document

New and changed documents:
RSS Feed HTML RSS Feed PDF