Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Format Changing


Hi,

I am having week as 'w1'. I need it to be written as 'W01'.

Is that possible? and could you please suggest me the logic?

Thamks & Regards,

Vinitha Mano R.

6 Replies
Not applicable
Author

Please see the attached example. You would use the code something like this:

LEFT(WeekField,1)&0&RIGHT(WeekField,LEN(WeekField)-1) AS Final

If it was only a 0 for 1-9 and then no zero there after you can sort that with an IF statement.

Let me know if that works.

Dan

Not applicable
Author

This could actually be simplified to:

'W'&0&RIGHT(WeekField,LEN(WeekField)-1) AS Final

Nicole-Smith

Daniel Roberts is on the right track, but both of his solutions add an extra zero for any week greater than one digit (for w10, both of his return w010).

To avoid having the extra 0, here is another option (example.qvw also attached):

'W'&num(PurgeChar(Week, 'w'),'00')

CELAMBARASAN
Partner - Champion
Partner - Champion

Try like this

=Num(Num#(FieldName, 'w##'), 'W00')

or

='W' & Num(Num#(Right(FieldName, Len(FieldName) - 1), '##'), '00')

kiranmanoharrode
Creator III
Creator III

Try this

='W'&num(PurgeChar(Week, 'w'),'00')

Anonymous
Not applicable
Author

There are countless ways.  Here is one more:

='W' & num(mid(Week,2),'00')