不,你絕對不能創建一個latChild屬性沒有時間維度:
![enter image description here](https://i.stack.imgur.com/aGs9v.jpg)
您可以做的是在您的DSV上創建一個查詢,爲您提供最後一個子值並使用它創建度量值組。例如:
腳本:
create table dim(
id int not null primary key,
name varchar(50))
insert into dim values (1,'one'),(2,'two')
create table fact(
id int not null primary key,
dimId int not null,
value numeric (12,3),
constraint fk_fact_dim foreign key(dimId) references dim(id))
insert into fact values (1,1,5)
insert into fact values (2,1,3)
insert into fact values (3,2,10)
insert into fact values (4,2,20)
,創建一個暗淡和事實表非常簡單的腳本。下面是一個簡單的選擇和結果後,我想你想,那麼3和20是基於維度的ID的最後的值:
![enter image description here](https://i.stack.imgur.com/fYoHg.jpg)
建立,這是非常簡單,只需右鍵點擊你的DSV並添加一個新的命名查詢並通知查詢來創建您的最後一個值。在我的情況是:
select dimId,
(select top 1 value from fact where dimId=F.dimId order by id desc) as lastValue
from fact F
group by dimId
創建邏輯主鍵,並將其鏈接到維度表: ![enter image description here](https://i.stack.imgur.com/oqOYy.jpg)
,並在你的立方體,用鼠標右鍵單擊任意空白區域,選擇「顯示所有表」,並添加你的新桌子。
並在您的立方體創建一個新的措施,因爲 「沒有聚合」,因爲你已經彙總查詢:
![enter image description here](https://i.stack.imgur.com/AHqVS.jpg)
結果:
![enter image description here](https://i.stack.imgur.com/rMcmy.jpg)