Named Calculation - Error
dear friends,
i have statment in named calculation...:
case
when [open amount]<=0 0
else
(((case
when [d_inst_tipo_id]=1 then
case
when [d_pricenpv] = 0 [d_avgprice]
else [d_pricenpv]
end
when [d_inst_tipo_id]=2 then
case
when [d_pricenpv] <> 0 [d_pricenpv]
else
case
when [d_principalcumul]=0 [d_avgprice]
else 100
end
end
end
+ [d_accrued])/100*[d_notional]/[d_fxrate]) *
(case
when [d_baselweight]<>20 [d_baselweight]
else
case
when (convert(decimal(10,8),datediff("dd", [date],[d_maturitydate])/ convert(decimal(10,4), 365)))<=0.5 3.125
else
case
when (convert(decimal(10,8),datediff("dd", [date],[d_maturitydate])/ convert(decimal(10,4), 365)))>=2 20
else 12.5
end
end
end)) / 100
end
the problem filed [date]... value comes dimension table time!! in facttable, i'm creting named calculation, date fields integer fk time dimension... how can read date value named calculation in facttable??
thanks!
let me see if understand:
- this calculation on [date] entity in dsv (as it's stated above)
- it belongs on fact table (it looks it's calculating measure)
- but problem have maturity date can found on date dimension, , must looked sort of transaction date on fact table?
if case can either use view in database or named query in dsv join the fact table dimension table (so can see how far away maturity date is) , apply right weight calculation.
SQL Server > SQL Server Analysis Services
Comments
Post a Comment