Hi,
I have been trying to optimize a few DAX calculations that I have in my cube and ran into this problem
Basically my DAX Measure
Counterparty Collateral Base DKK:=
[Counterparty Collateral Contracts DKK (filtered)]
+
CALCULATE(-[Account Balances DKK], Accounts[Counterpart Type ID] <> 8, Accounts[ContractTypeID] <> 14, Accounts[ContractTypeID] <> 16)
is pretty fast,
whereas as soon as I change the 2nd part to only add Account Balance if its>0, it takes ages i.e.
Counterparty Collateral Base DKK:=
[Counterparty Collateral Contracts DKK (filtered)]
+
IF(CALCULATE(-[Account Balances DKK], Accounts[Counterpart Type ID] <> 8, Accounts[ContractTypeID] <> 14, Accounts[ContractTypeID] <> 16)>0,
CALCULATE(-[Account Balances DKK], Accounts[Counterpart Type ID] <> 8, Accounts[ContractTypeID] <> 14, Accounts[ContractTypeID] <> 16),0)
Offcourse because I check every row I suppose with that "if" statement. Question is how do I improve it?
By the Way: [Account Balances DKK] is in the table - Account Balances
[Counterparty Collateral Contracts DKK (filtered)] is in the table- Open Positions
This calculated measure [Counterparty Collateral Base DKK] is in Open Positions
And the query in MDX, that I run to pull this measure, looks like
select {[Measures].[Counterparty Collateral Base DKK]
}on 0,
Non Empty {[Accounts].[Counterpart ID].children
*[Base Currencies].[Currency Code].children
*[Products].[Product Name].children
} on 1
from [model]
where [Dates].[Date].&[2015-06-30T00:00:00]
The requirement is such that I have to add the measures in two separate tables.
How can I improve the performance when adding the filter?
Any help would be appreciated.