Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to calculate net balance month on month using a column - DMBTR that lists all the debit and credit transactions. Another column,SHKZG which is an indicator tells us which line is a credit and which one is a debit.
For ex: If SHKZG = 'S' then its a debit and if SHKZG = 'H' then its a credit.
So using this I need to calculate the net difference between debit and credit transactions. I am using the below expression:
Sum(sum(if(SHKZG = 'H',DMBTR))-sum(if(SHKZG='S',DMBTR)))
Try this
Sum(DMBTR * If(SHKZG = 'H', 1, -1))
or this
RangeSum(
Sum({<SHKZG = {'H'}>}DMBTR),
-Sum({<SHKZG = {'S'}>}DMBTR)
)
Try this
Sum(DMBTR * If(SHKZG = 'H', 1, -1))
or this
RangeSum(
Sum({<SHKZG = {'H'}>}DMBTR),
-Sum({<SHKZG = {'S'}>}DMBTR)
)
Thanks! the expression looks correct to me but somehow it is returning 0 balance on a month on month basis which ideally should not be the case.
Would you be able to share a sample where we can see the issue?