Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Negative Amount

In my data table I find some negative amount which I want to convert to positive figures in the loading script

TB:

LOAD BAL_ACCT_CODE,

     NOTE,

     CLA_CODE,

     GROUP_CODE,

     YEAR,

     MONTH,

  

  if (AMOUNT<0,AMOUNT*-1)as  AMOUNT,

     BCOD

FROM

[..\QVD\FACT_Table\Trial_Balance.qvd]

(qvd);

My script is as above but line in red does not give desired result. Pls see where there is any error in myscript

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Try like below load script but what about that values which are not - ive by your line only -ive values convert to positive

TB:

LOAD

     BAL_ACCT_CODE,

     NOTE,

     CLA_CODE,

     GROUP_CODE,

     YEAR,

     MONTH,

     if (AMOUNT < 0, AMOUNT * -1, AMOUNT ) as  AMOUNT,

     BCOD

FROM

[..\QVD\FACT_Table\Trial_Balance.qvd]

(qvd);

Ex:-

LOAD Amt, if(Amt < 0,Amt * -1,Amt)as  AMT;

LOAD * Inline

[

Amt

-2

23

566

-4

-5

];

View solution in original post

3 Replies
ashfaq_haseeb
Champion III
Champion III

Hi,

try to use fabs().

Look at the attached application

Regards

ASHFAQ

its_anandrjs
Champion III
Champion III

Try like below load script but what about that values which are not - ive by your line only -ive values convert to positive

TB:

LOAD

     BAL_ACCT_CODE,

     NOTE,

     CLA_CODE,

     GROUP_CODE,

     YEAR,

     MONTH,

     if (AMOUNT < 0, AMOUNT * -1, AMOUNT ) as  AMOUNT,

     BCOD

FROM

[..\QVD\FACT_Table\Trial_Balance.qvd]

(qvd);

Ex:-

LOAD Amt, if(Amt < 0,Amt * -1,Amt)as  AMT;

LOAD * Inline

[

Amt

-2

23

566

-4

-5

];

upaliwije
Creator II
Creator II
Author

Thanks both of You