SOLVED

Calculate a Sum with Lambda

%3CLINGO-SUB%20id%3D%22lingo-sub-2179302%22%20slang%3D%22en-US%22%3ECalculate%20a%20Sum%20with%20Lambda%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2179302%22%20slang%3D%22en-US%22%3E%3CP%3EI%20defined%20a%20recursive%20lambda%20call%20%22Sum_L%22%20to%20calculate%20the%20Sum%20of%20nth%20parcels%20but%20received%20%23value%3C%2FP%3E%3CP%3E%3DLAMBDA(tcp%2Ctt%2Cn%2CIF(n%26lt%3B1%2C0%2CSum_L(n-1)%2B((1%2Btcp)%2F(1%2Btt))%5En))%3C%2FP%3E%3CP%3ECan%20u%20help%20to%20resolve%20this%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance%3C%2FP%3E%3CP%3EPedro%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2179302%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2180524%22%20slang%3D%22en-US%22%3ERe%3A%20Calculate%20a%20Sum%20with%20Lambda%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2180524%22%20slang%3D%22en-US%22%3E%3CP%3EYour%20lambda%20requires%20three%20parameters%20(tcp%2C%20tt%2C%20n)%2C%20so%20your%20reference%20to%20itself%20should%20have%203%20parameters%20as%20well.%20If%20tcp%2C%20tt%20don't%20change%2C%20it%20would%20be%20this%3A%20LAMBDA(tcp%2Ctt%2Cn%2CIF(n%26lt%3B1%2C0%2CSum_L(%3CSTRONG%3Etcp%3C%2FSTRONG%3E%2C%3CSTRONG%3Ett%3C%2FSTRONG%3E%2C%3CSTRONG%3En-1%3C%2FSTRONG%3E)%2B((1%2Btcp)%2F(1%2Btt))%5En))%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20see%20attached.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2179563%22%20slang%3D%22en-US%22%3ERe%3A%20Calculate%20a%20Sum%20with%20Lambda%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2179563%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F584627%22%20target%3D%22_blank%22%3E%40chgross%3C%2FA%3E%20can%20you%20help%3F%3C%2FLINGO-BODY%3E
New Contributor

I defined a recursive lambda call "Sum_L" to calculate the Sum of nth parcels but received #value

=LAMBDA(tcp,tt,n,IF(n<1,0,Sum_L(n-1)+((1+tcp)/(1+tt))^n))

Can u help to resolve this?

 

Thanks in advance

Pedro

 

2 Replies
@chgross can you help?
best response confirmed by cuong (Microsoft)
Solution

Your lambda requires three parameters (tcp, tt, n), so your reference to itself should have 3 parameters as well. If tcp, tt don't change, it would be this: LAMBDA(tcp,tt,n,IF(n<1,0,Sum_L(tcp,tt,n-1)+((1+tcp)/(1+tt))^n))

 

Please see attached.