Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Need help with what function to use

I have a requirement where I want to add 2 leading  zero if the department is 1 character, if it is 2 character 1 leading zero and if it is 3 leave is as it is. 

So From the attached file  I need something like this

000,002,003,004....012,013,014....104,108

 

Any help would be greatly appreciate it.

 

1 Solution

Accepted Solutions
Highlighted

Try one of these

Num(Dept_No, '000') as Dept_No

or

Text(Num(Dept_No, '000')) as Dept_No

 

View solution in original post

2 Replies
Highlighted

Try one of these

Num(Dept_No, '000') as Dept_No

or

Text(Num(Dept_No, '000')) as Dept_No

 

View solution in original post

Highlighted
Specialist
Specialist

Try 

Text(IF( Len(Dept_No) <3,  Repeat( '0', 3-Len(Dept_No))& Dept_No,Dept_No )) as Dept_No