Ratio to report: ratio_to_report
Syntax
in a Data Set expression |
ratio_to_report ( dataset over ( partitionClause ) ) |
in a Component expression within a calc clause |
ratio_to_report ( component over ( partitionClause ) ) |
Input parameters
dataset |
the operand Data Set |
component |
the operand Component |
partitionClause |
see Analytic invocation |
Semantics for scalar operations
This operator cannot be applied to scalar values.
Input parameters type
dataset
dataset { measure<number> _+ }
component
component<number>
Result type
result
dataset { measure<number> _+ }
| component<number>
Additional Constraints
The Aggregate invocation is not allowed.
The orderClause and windowClause of the Analytic invocation syntax are not allowed.
Behaviour
The operator returns the ratio between the value of the current Data Point and the sum of the values of the partition which the current Data Point belongs to.
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 |
2000 |
3 |
1 |
A |
XX |
2001 |
4 |
3 |
A |
XX |
2002 |
7 |
5 |
A |
XX |
2003 |
6 |
1 |
A |
YY |
2000 |
12 |
0 |
A |
YY |
2001 |
8 |
8 |
A |
YY |
2002 |
6 |
5 |
A |
YY |
2003 |
14 |
-3 |
Example 1
DS_r := ratio_to_report ( DS_1 over ( partition by Id_1, Id_2 ) );
results in (see structure):
Id_1 |
Id_2 |
Id_3 |
Me_1 |
Me_2 |
---|---|---|---|---|
A |
XX |
2000 |
0.15 |
0.1 |
A |
XX |
2001 |
0.2 |
0.3 |
A |
XX |
2002 |
0.35 |
0.5 |
A |
XX |
2003 |
0.3 |
0.1 |
A |
YY |
2000 |
0.3 |
0 |
A |
YY |
2001 |
0.2 |
0.8 |
A |
YY |
2002 |
0.15 |
0.5 |
A |
YY |
2003 |
0.35 |
-0.3 |