First value: first_value

Syntax

in a Data Set expression

first_value ( dataset over ( analyticClause ) )

in a Component expression within a calc clause

first_value ( component over ( analyticClause ) )

Input parameters

dataset

the operand Data Set

component

the operand Component

analyticClause

see Analytic invocation

Semantics for scalar operations

This operator cannot be applied to scalar values.

Input parameters type

dataset

dataset { measure<scalar> _+ }

component

component<scalar>

Result type

result

dataset
| component<scalar>

Additional Constraints

The Aggregate invocation is not allowed.

Behaviour

The operator returns the first value (in the value order) of the set of Data Points that belong to the same analytic window as the current Data Point.

When invoked at Data Set level, it returns the first value for each Measure of the input Data Set. The first value of different Measures can result from different Data Points. When invoked at Component level, it returns the first value of the specified Component.

For other details, see Analytic invocation.

Examples

Given the operand dataset DS_1:

Input DS_1 (see structure)

Id_1

Id_2

Id_3

Me_1

Me_2

A

XX

1993

3

1

A

XX

1994

4

9

A

XX

1995

7

5

A

XX

1996

6

8

A

YY

1993

9

3

A

YY

1994

5

4

A

YY

1995

10

2

A

YY

1996

2

7

Example 1

DS_r := first_value ( DS_1 over ( partition by Id_1, Id_2 order by Id_3 data points between 1 preceding and 1 following));

results in (see structure):

DS_r

Id_1

Id_2

Id_3

Me_1

Me_2

A

XX

1993

3

1

A

XX

1994

3

1

A

XX

1995

4

9

A

XX

1996

7

5

A

YY

1993

9

3

A

YY

1994

9

3

A

YY

1995

5

4

A

YY

1996

10

2