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: 
YanivZi
Contributor III
Contributor III

Negative values with sign

I am loading  some values that are formed like that: '-0000000151515' and some like this '0000000151515'.

The values with the minus sign are interpreted in the model like this: 151515M (and sometimes other capital letters)

I like to do this:

  1. Remove leading zeros 
  2. Keep the minus if exists

I've tried

Num#(Sample, '0;0-') as Amount2

 but it did not worked 

Labels (1)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

If you try 

 

Sample*1 as Sample

 

Aurélien 

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

3 Replies
luizcdepaula
Creator III
Creator III

Hi Yaniv,

If you don't have decimals with 0 before the decimal separator, the below should work.

REPLACE(num(LTRIM(REPLACE(Sample, '0',' '))),' ', '0') 

Cheers,

Luiz

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

If you try 

 

Sample*1 as Sample

 

Aurélien 

Help users find answers! Don't forget to mark a solution that worked for you!
YanivZi
Contributor III
Contributor III
Author

Both answers were right! but @Aurelien_Martinez  solution was very simple and do the same job.