2016-10-05 37 views
0

我使用餘額日期和轉換率有效時的MatchInterval將一系列期末餘額與一組貨幣匯率掛鉤。我在這兩個領域都有多種貨幣,因此當兩種貨幣匹配並適用正確的匯率時都希望返回。設置分析比較兩個字段

sum({$ <BalanceAutoNumber={"=BalanceCurrency=Currency"}>} ClosingBalance*CADMultiply) 

根據在線指南,我已將BalanceAutoNumber字段添加到餘額表作爲我要選擇的維度。但是,我只有在手動選擇兩個字段時纔會得到結果。

我可以按照以下

sum(if(CompanyCurrency=Currency,ClosingBalance*CADMultiply,0)) 

回答

0

作爲過渡方案使用IF語句實現這一點,我已經修改了我的數據模型,使數據力之間的間隔匹配鏈接這種關係。

CurrencyIntervalMatchRaw: 
IntervalMatch(DateForCurrencyRates) 
Load distinct StartDateTime, EndDateTime 
Resident CurrencyRates; 

join(CurrencyIntervalMatchRaw) 
Load Distinct Currency 
Resident CurrencyRates; 


CurrencyIntervalMatch: 
Load date(DateForCurrencyRates,'YYYYMMDD')&'_'&Currency as %Join_CurrencyRates, 
    Currency, 
    StartDateTime, 
    EndDateTime 
Resident CurrencyIntervalMatchRaw; 

Drop Table CurrencyIntervalMatchRaw; 
Drop Field DateForCurrencyRates From Balances; 

有了這個修改後的模型,我不需要設置分析來限制顯示的數據。