Hi!
I haver 3 tables on my model:
PERSON_TABLE
-------------
PERSON_ID
CONTRACT_DATE
EXPED_TABLE
---------------
EXPED_ID
EXPED_TYPE_ID
EXPED_CLASS_ID
EXPED_DATE
EXPED_TYPE_TABLE
-------------
EXPED_TYPE_ID
EXPED_TYPE_DESC
We need to create a report like:
ATRIBUTTE:exped_type_desc
METRIC(compound metric):
(Num Exped (Class=1 & Exped_Month=January)) /(Num Persons (Contr_Month=January))
Dimensionality for metric Num Persons is: Report level-standard-standar and
Exped_type_desc-ignore-none
Report generate SQL like next:
-- calculate Num Exped
CREATE TABLE1
SELECT EXPED_TYPE_ID,
COUNT(DISTINCT EXPED_ID) AS NUM_EXP
FROM EXPED_TABLE
WHERE EXPED_CLASS_ID = 1
AND MONTH(EXPED_DATE)='JANUARY'
GROUP BY EXPED_TYPE_ID
-- calculate Num Persons
CREATE TABLE 2
SELECT COUNT(DISTINCT PERSON_ID) AS NUM_PERS
FROM PERSON_TABLE
WHERE MONTH(CONTR_DATE)='JANUARY'
-- join everything
SELECT EXPED_TYPE_DESC,
NUM_EXP/NUM_PERS
FROM TABLE1 A,
TABLE2 B,
EXPED_TYPE_TABLE C
WHERE A.EXPED_TYPE_ID= C.EXPED_TYPE_ID
On 3rd query appears a cross join because there is not relationship between
EXPED_TYPE_TABLE & PERSON_TABLE. I can´t enable cross join on my project and users
want to use this metric with every atribute from the project.
It´s possible to create a non-real relationship to not use cross-join on my report?
Thanks
I haver 3 tables on my model:
PERSON_TABLE
-------------
PERSON_ID
CONTRACT_DATE
EXPED_TABLE
---------------
EXPED_ID
EXPED_TYPE_ID
EXPED_CLASS_ID
EXPED_DATE
EXPED_TYPE_TABLE
-------------
EXPED_TYPE_ID
EXPED_TYPE_DESC
We need to create a report like:
ATRIBUTTE:exped_type_desc
METRIC(compound metric):
(Num Exped (Class=1 & Exped_Month=January)) /(Num Persons (Contr_Month=January))
Dimensionality for metric Num Persons is: Report level-standard-standar and
Exped_type_desc-ignore-none
Report generate SQL like next:
-- calculate Num Exped
CREATE TABLE1
SELECT EXPED_TYPE_ID,
COUNT(DISTINCT EXPED_ID) AS NUM_EXP
FROM EXPED_TABLE
WHERE EXPED_CLASS_ID = 1
AND MONTH(EXPED_DATE)='JANUARY'
GROUP BY EXPED_TYPE_ID
-- calculate Num Persons
CREATE TABLE 2
SELECT COUNT(DISTINCT PERSON_ID) AS NUM_PERS
FROM PERSON_TABLE
WHERE MONTH(CONTR_DATE)='JANUARY'
-- join everything
SELECT EXPED_TYPE_DESC,
NUM_EXP/NUM_PERS
FROM TABLE1 A,
TABLE2 B,
EXPED_TYPE_TABLE C
WHERE A.EXPED_TYPE_ID= C.EXPED_TYPE_ID
On 3rd query appears a cross join because there is not relationship between
EXPED_TYPE_TABLE & PERSON_TABLE. I can´t enable cross join on my project and users
want to use this metric with every atribute from the project.
It´s possible to create a non-real relationship to not use cross-join on my report?
Thanks