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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
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
Partner - Champion III
Partner - Champion III

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