2016-10-05 74 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; 

有了这个修改后的模型,我不需要设置分析来限制显示的数据。