Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
patrou38
Creator
Creator

added text in load

Hello,

In the load function, I would like to test if my WEEK is with 2 digits and if not I would like to add a Zero before.

The below expression doesn't work 🙂

someone could help me ?

LOAD
Year&
if(len([Week]>1),[Week],'0'&[Week]) as ID_Temps,
...
FROM ...

Thank you in advance,

Patrick

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this?

IF(Len(Week) < 2, 0&Week, Week)

OR

if(len([Week]) >1, [Week], 0&[Week]) as ID_Temps,

View solution in original post

6 Replies
vishsaggi
Champion III
Champion III

Try this?

IF(Len(Week) < 2, 0&Week, Week)

OR

if(len([Week]) >1, [Week], 0&[Week]) as ID_Temps,

krishnacbe
Partner - Specialist III
Partner - Specialist III

Try below expression

if(Len(Week)=1, 0 & [Week], [Week]) as ID_Temps

m_woolf
Master II
Master II

What results are you getting with that expression?

Maybe:

if(len([Week]>1),text([Week]),text('0'&[Week])) as ID_Temps,

patrou38
Creator
Creator
Author

It works, thank you 🙂

patrou38
Creator
Creator
Author

This expression works also (and it's more simple from my point of view 😉

thank you for all

patrou38
Creator
Creator
Author

the result is that a Zero was added before my number with 1 digit . I have 01 instead 1 and for the number like 10, 11, 12 they stay as they are 😉