My model is made up of month end actual balance sheet balance and associated interest rates and I’m looking to compare month on month change in both balances & weighted rates (earnings). The data is organised at account level aggregating up into different summarised levels.
I have created the measure ‘Current Weighted Rate’ for the current month as follows which works ok:-
CM Weighted Rate =
DIVIDE(
SUMX('Margin&BalanceSheet','Margin&BalanceSheet'[interestbalance]*'Margin&BalanceSheet'[interestrate]),'Key Measures - Current Month'[CM Interest Balance],0)
I’m now trying to create the same measure for the previous month as follows but I get an error.
LM Weighted Rate =
DIVIDE(
CALCULATE(SUMX('Margin&BalanceSheet'[interestbalance]), DATEADD('Margin&BalanceSheet'[interestrate],-1,MONTH)) *
DATEADD('Margin&BalanceSheet'[interestrate],-1,MONTH),
CALCULATE(SUMX('Margin&BalanceSheet'[interestbalance]), DATEADD('Margin&BalanceSheet'[asatdate],-1,MONTH)))
Too few arguments were passed to the SUMX function. The minimum argument count for the function is 2.
Other expressions for previous month balances work fine
LM Interest Balance =
CALCULATE(SUM('Margin&BalanceSheet'[interestbalance]), DATEADD('Margin&BalanceSheet'[asatdate],-1,MONTH))
Thanks for the reply, but i’m not sure this will work for me.
I think that I have another complexity when calculating the weighted rate for the previous month as it has two variables which both need to reference the previous month.
In essence my weighted rate is calculated using sumx by mutiplying the [interestbalance] by the [interestrate] on all my product lines and then dividing it by the sum of the[interestbalance] to give me my current months weighted rate as below and that works fine.
CM Weighted Rate =
DIVIDE(
SUMX(‘Margin&BalanceSheet’,‘Margin&BalanceSheet’[interestbalance]*‘Margin&BalanceSheet’[interestrate]),
‘Key Measures - Current Month’[CM Interest Balance],0)
The complexity is that my prior month weighted calculation needs to be based on the balance for last month multiplied by the rate for the last month. Getting the balance for last month is no problem using the adddate function, but the issue i have is bringing the rate into the same calculation as its not a SUM of rate.
I think that i have a less then elegant solution by adding a new column to the data model which multiplies the balance by the rate for all products and then my new measure can reference this for the prior month and divide by the prior month total.
The attached excel will i hope make it a little clearer of the measures i’m looking for
Hi @Simon_Garrett, due to the length by which this post has been active, we are tagging it as Solved. For further questions related to this post, please make a new thread.