SYMPTOM
Below the generated SQL with comments.
// calcul the A metric
select a11.societe societe,
a11.devise devise,
a11.date_effet date_effet,
a11.valeur WJXBFS1
into ##T17OB967KMD000
from [valeur$] a11
// calculate the base metric for B
select a11.societe societe,
a11.devise devise,
a11.date_devise date_devise,
a11.taux WJXBFS1
into ##TXFQR8W1CMD001
from [Convert$] a11
// SQL calculate the R when B is not computed.
select pa11.societe societe,
pa11.devise devise,
pa11.date_effet date_effet,
sum(ISNULL((pa11.WJXBFS1 / NULLIF(pa12.WJXBFS1, 0)), 0)) WJXBFS1
into ##TNNRNPKQOMD002
from ##T17OB967KMD000 pa11
join ##TXFQR8W1CMD001 pa12
on (pa11.devise = pa12.devise and
pa11.societe = pa12.societe)
group by pa11.societe,
pa11.devise,
pa11.date_effet
// caluate end of fact for B
select pc11.societe societe,
pc11.devise devise,
max(pc11.date_devise) WJXBFS1
into ##T27UNLM28MB003
from ##TXFQR8W1CMD001 pc11
group by pc11.societe,
pc11.devise
// the SQL pass in red should be the one in blue below
select pa11.societe societe,
pa11.devise devise,
pa11.date_effet date_effet,
sum(ISNULL((pa11.WJXBFS1 / NULLIF(pa12.WJXBFS1, 0)), 0)) WJXBFS1
into ##TNNRNPKQOMD002
from ##T17OB967KMD000 pa11
join ##T27UNLM28MB003 pa12
on (pa11.devise = pa12.devise and
pa11.societe = pa12.societe)
group by pa11.societe,
pa11.devise,
pa11.date_effet
Pass4 - Query Pass Start Time: 09/11/2016 19:56:10
select distinct pa11.societe societe,
pa11.devise devise,
pa11.WJXBFS1 WJXBFS1
into ##TI6VI24HCNC004
from ##TXFQR8W1CMD001 pa11
join ##T27UNLM28MB003 pa12
on (pa11.date_devise = pa12.WJXBFS1 and
pa11.devise = pa12.devise and
pa11.societe = pa12.societe)
Pass5 - Query Pass Start Time: 09/11/2016 19:56:10
Query Pass End Time: 09/11/2016 19:56:10
Query Execution: 0:00:00.01
Data Fetching and Processing: 0:00:00.00
Data Transfer from Datasource(s): 0:00:00.00
Other Processing: 0:00:00.03
Rows selected: 4
select pa11.date_effet date_effet,
pa11.devise devise,
pa11.societe societe,
pa11.WJXBFS1 WJXBFS1,
pa12.WJXBFS1 WJXBFS2,
pa13.WJXBFS1 WJXBFS3
from ##TNNRNPKQOMD002 pa11
join ##TI6VI24HCNC004 pa12
on (pa11.devise = pa12.devise and
pa11.societe = pa12.societe)
join ##T17OB967KMD000 pa13
on (pa11.date_effet = pa13.date_effet and
pa11.devise = pa13.devise and
pa11.societe = pa13.societe)
STEPS TO REPRODUCE
1. Create A as a simple metric
2. Create B as a level metric with ending fact dimension.
3. Calculating a ratio metric R=sum(A/B)
The SQL engine does not use B as a level metric when calculating R.
ACTION
This issue was reviewed by our Technology team for feasibility and will not be scoped for a code fix in any upcoming Strategy release.
WORKAROUND
It is suggested to set the compound metric, in our example "B", as Smart Metric. In this manner it would not be calculated in SQL but in analytics engine.
KB439794