Hi,
I am using OBIEE 12C.
I'm trying to accomplish the following scenario:
I have an orders table & order status table, they are connected with order_id.
In orders tables I have a COST column which I want to calculate its average.
Example (tables):
ORDERS
ORDER_STATUS
| | STATUS_DATE |
|---|
| 1 | 90 | 01/01/2019 |
| 1 | 91 | |
| 1 | 92 | |
| 2 | 90 | 01/01/2019 |
| 2 | 91 | 01/01/2020 |
So if I want to calculate AVG cost for all orders the answer will be 15 ((10+20)/2).
Now my problem is that if I want to filter my report to Average only orders from year =2019, OBIEE will create a JOIN between ORDERS and ORDER_STATUS tables.
This JOIN causes an incorrect average calculation: I get AVG = 13.33333. ((10*2) +20)/3
My question:
Can I somehow AVG only DISTINCT ORDER_IDs?
Thanks in advance,
Itai