The following scenario shows how you can use the query definition to count the results of a calculated key figure.
You have loaded the following data into your InfoProvider:
Region |
Customer |
Sales |
---|---|---|
|
|
USD |
NY |
A |
400,000 |
B |
200,000 |
|
C |
50,000 |
|
CA |
A |
800,000 |
C |
300,000 |
In the query, you want to determine the number of customers where the revenue is under 1,000,000 USD. To do this, you create the calculated key figure Revenue Customer <= 1,000,000 (F1) with the following properties:
Formula definition: Revenue <= 1,000,000
Exception aggregation: Total, reference characteristic: Customer
This query would deliver the following result:
Region |
Customer |
Sales |
F1 |
---|---|---|---|
|
|
USD |
|
NY |
A |
400,000 |
1 |
B |
200,000 |
1 |
|
C |
50,000 |
1 |
|
Result |
650,000 |
3 |
|
CA |
A |
800,000 |
1 |
C |
300,000 |
1 |
|
Result |
1,100,000 |
2 |
|
Overall Result |
1,750,000 |
2 |
The grand total of the calculated key figure F1 is calculated as follows:
Revenue customer A (400,000 + 800,000) does not meet the condition (revenue <= 1.000.000) - the result is 0,
Revenue customer B (200,000) meets the condition - the result is 1,
Revenue customer C (50,000 + 300,000) meets the condition - the result is 1,
The grand total for F1 is 2.
A query with the breakdown according to region would give the following result:
Region |
Sales |
F1 |
---|---|---|
|
USD |
|
NY |
650,000 |
3 |
CA |
1,100,000 |
2 |
Overall Result |
1,750,000 |
2 |
By assigning the reference feature Customer during the exception aggregation of the calculated key figure F1, the query also returns the required data without a breakdown according to reference features.