Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

amit_saini
Honored Contributor III

Net Calulation Help

Hi Folks,

Below is my condition for the Net cal:

Formula:

If MSEG-SHKZG = H, MSEG-DMBTR is negative (i.e. MSEG-DMBTR is 9.207,87 the value to calculate with is –9.207,87)

If MSEG-SHKZG = S, MSEG-DMBTR is positive

Get for each entry selected MSEG-DMBTR and convert to either negative or positive value.

Calculate the converted values to a net total.

  1. I.e. -100 + 50 = -50

I'm trying for something like below for the Calculation :

if(Debit_Credit_Indicator='H',- sum(Amt_Local_Curr), if(Debit_Credit_Indicator='S',sum(Amt_Local_Curr)))

Any suggestions to calculate in the best way???

Thanks,

AS

1 Solution

Accepted Solutions
MVP
MVP

Re: Net Calulation Help

Avoid calculating the sum twice with:

=Sum(If(Debit_Credit_Indicator='H', -1, 1) * Amt_Local_Curr)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
8 Replies

Re: Net Calulation Help

Hi,

Please see the attached file.

This is what you are looking for?

Not applicable

Re: Net Calulation Help

can remove 2 nd if right?

if(Debit_Credit_Indicator='H',- sum(Amt_Local_Curr),sum(Amt_Local_Curr))

amit_saini
Honored Contributor III

Re: Net Calulation Help

Kush,

In ur case output should be +500 not -300.

Thanks,

AS

MVP
MVP

Re: Net Calulation Help

Avoid calculating the sum twice with:

=Sum(If(Debit_Credit_Indicator='H', -1, 1) * Amt_Local_Curr)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
amit_saini
Honored Contributor III

Re: Net Calulation Help

Yes for sure you can do this.

Thanks,
AS

MVP
MVP

Re: Net Calulation Help

Hi,

Try like this using set analysis

=-sum({<Debit_Credit_Indicator={'H'}>} Amt_Local_Curr) + sum({<Debit_Credit_Indicator={'S'}>}Amt_Local_Curr)

Hope this helps you.

Regards,

Jagan.

amit_saini
Honored Contributor III

Re: Net Calulation Help

Thanks Jonathan!

looks to me this is right approach.

Thanks,
AS

amit_saini
Honored Contributor III

Re: Net Calulation Help

Thanks Jagan

Community Browser