# Connectivity & Data Prep

Announcements
Coming Aug. 9: New Simplified Authoring for Qlik Sense SaaS – For Details, CLICK HERE
cancel
Showing results for
Did you mean:
Contributor

## Conversion of Numeric Value to format to 5 digit with leading zeros to text value

Good Afternoon,

I have a field pulled for Sharepoint, that is configured as a numeric value. I am then attempting to take this value and make sure it is always formatted as a 5 digit number with preceding zeros.  From that point, I need to then convert it to a text value to match the formatting from other tables and "link" up as the same field.

Num(title,'00000') as title,
text(title) as storelocation,

This is the arguement I am trying, but does not seem to work. When using a  variation of if arguments, it blanket added zeros without considering it should only be a max value of 5 digits, and filling the preceding values with zero.

Any assistacne would be appreciated.

Labels (1)
• ### Data Prep

1 Solution

Accepted Solutions
Champion

Perhaps:

Repeat('0',5-len(title)) & num(title)

3 Replies
Champion

Perhaps:

Repeat('0',5-len(title)) & num(title)

Contributor
Author

Tried that solution, however it did not accomplish the intended goal. If you see, below I am essentially trying to convert or format the non-5 digit values into 5 digit values. Then convert that output into text to match the other storelocation field in other tables.

 38 0 00002 00003 00009 9 00015 00017 17 00018 18 00021 00025 00031 00034 00037 37 00038 00039 00042 42 00048
Champion

You'll have to explain what problem you're encountering, because the formula in question should pad any number shorter than 5 digits with enough leading 0s to make it five digits - which is your stated goal.