Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
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.