Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Negative to positive number conversion

I have the following expression

Num([Drug Code],'000000') as [Drug Code]


How can the above expression be adapted to change negative numbers into positive numbers in cases where these negative numbers exist in addition to formatting a number into a six digit one when required?


Regards


Chris

1 Solution

Accepted Solutions
preminqlik
Specialist II
Specialist II

try this

Num(fabs([Drug Code]),'000000')  as [Drug Code]

View solution in original post

4 Replies
preminqlik
Specialist II
Specialist II

try this

Num(fabs([Drug Code]),'000000')  as [Drug Code]

jagan
Luminary Alumni
Luminary Alumni

Hi,

Use Fabs() to convert negative to positive.

Fabs(Num([Drug Code],'000000')) as [Drug Code]

Regards,

Jagan.

Anonymous
Not applicable
Author

Prem, many thanks, i will try it out and revert

Regards

Chris

Anonymous
Not applicable
Author

Jagan, many thanks, i will try it out and advise accordingly

Regards.

Chris