Is "zero padding" possible in formula of Anaplan?

KOBAYASHI
Contributor

Is "zero padding" possible in formula of Anaplan?

Hello, 
Is "zero padding" possible in formula of Anaplan?

What I'd like to do is, for example, changing "123" to "00123" or "1234" to "01234" if a number has to be held as five digits.

In other words, I'd like to insert zeros into the left side of number until the number holds a specific number of digits. 

I came up with the idea of using multiple "ifs" but this is not very efficient especially when the digit of original numbers greatly varies.  

Thank you very much in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Misbah
Moderator

@KOBAYASHI 

 

  1. Create a module - Module 1 (No dimension) with one line item holding zeroes. (n zeroes)
  2. In your Calculated module, concatenate Zeroes from Module 1 and the number from this module. Remember for concatenation to happen line items have to be text format or you need to convert numbers into texts with the help of TEXT function
  3. Use RIGHT function on the final number to derive as many digits as you want

Hope that helps

Misbah

View solution in original post

2 REPLIES 2
Misbah
Moderator

@KOBAYASHI 

 

  1. Create a module - Module 1 (No dimension) with one line item holding zeroes. (n zeroes)
  2. In your Calculated module, concatenate Zeroes from Module 1 and the number from this module. Remember for concatenation to happen line items have to be text format or you need to convert numbers into texts with the help of TEXT function
  3. Use RIGHT function on the final number to derive as many digits as you want

Hope that helps

Misbah

KOBAYASHI
Contributor

I really appreciate your answer.
I think I'm gonna give it a shot.
Again, thank you so much.