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: 
Not applicable

Convert +ve to -ve and -ve to +ve at script level

Hi,

I need to convert values in a field from negative to positive and where it is poritive to negative at the script level.

Please help.

Regards,

Utsav

1 Solution

Accepted Solutions
Not applicable
Author

got it done using the following command:

if(value<0,value*-1,value*-1)

Thanks

View solution in original post

6 Replies
tresesco
MVP
MVP

multiply the field by (-1) to get the new field.

Sokkorn
Master
Master

Hi Utsav,

Did you try this yet

LOAD

...

Field * -1     AS [Value],

...

Regards,

Sokkorn

Not applicable
Author

Hi Everyone,

yes i have tried it al but does not work.

I am using a select statement to while loading data from database...and along with it i want to use the multiply by -1 thing.

Regards,

Utsav

tresesco
MVP
MVP

try using a LOAD  statement over the SELECT statement. Like:

Load

      F1 *(-1) as NewF1;

SQL Select

     F1

From ....;

er_mohit
Master II
Master II

Ok

it seems you can do it

like this

LOAD -1* fieldname as New,

B,

C,

D;

    SQL SELECT * from tablename;

hope t helps

Not applicable
Author

got it done using the following command:

if(value<0,value*-1,value*-1)

Thanks