Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Formatting the amount field

AbhijeetChib
8 - Asteroid

Good Day Everyone 

 

I have this requirement where the amount field needs to be formatted against various formats, here is a sample. 

Thanks for your help in advance. 

 

Amount To be converted as 
  
830000830,000.00
15.000.00015,000.00
10.000.00010,000.00
250250.00
23.000.00023,000.00
130.000.000130,000,00
250.040.000250,040.00
213.000.000213.000.00
25.000.00025,000.00
7 REPLIES 7
AbhijeetChib
8 - Asteroid

Another set of format added to the above one

 

12345671.234.567.00
1.234.567,001,234,567.00
12.345,6712,345.67
binuacs
21 - Polaris
AbhijeetChib
8 - Asteroid

Thanks again @binuacs 

Check this out, why am I getting incorrect values. 

 

AbhijeetChib_0-1648555448649.png

 

binuacs
21 - Polaris
AbhijeetChib
8 - Asteroid

Thanks again @binuacs 

One thing gets fixed and breaks the other. I am attaching the entire sample data set. I have added I to the incorrect values, thanks again for your help. Ideally all thousands should be separated by "," and decimal by "."

 

Thanks a lot again 

binuacs
21 - Polaris
Luke_C
17 - Castor
17 - Castor

@AbhijeetChib Offering a non-regex solution:

 

  1. Check if the does not contain a period (if so, remove commas only). 
  2. Check if number does not contain a comma (if so, remove periods only).
  3. Check if the position of the first comma is less than the position of the first period
    1. If it is, remove the commas
    2. If it isn't, remove the periods and replace the comma with period
  4. Make this cleaned file numeric
  5. Use the tostring function to get the desired format

Luke_C_0-1648663178666.png

 

Labels
Top Solution Authors