Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
jharke
Creator II
Creator II

Weeknumber with two digits

Goodafternoon,

I have a field 'printingdate' which gives the date of making an invoice. I want to make a variable / field that gives the year + weeknumber.

With CTRL + ALT + V  I have defined: year([Print Date])&'_'&week([Print Date])

But if I sort descending. I get 2016_3 above 2016_25.

So I like to get every weeknumber with 2 digits --> 2016_3 should be 2016_03.

How do I get this right?

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Num(Week([Print Date]),'00')

View solution in original post

5 Replies
antoniotiman
Master III
Master III

Num(Week([Print Date]),'00')

Anonymous
Not applicable

Hi

year([Print Date])&'_'&week([Print Date])  please make this as





year([Print Date])&'_'&num(week([Print Date])  ,'00')






But not sure of   'sorting oder'


If the problem still persists, i think you should go for DUAL function for the correct SORTING .



jharke
Creator II
Creator II
Author

Hello Alluraiah Allu,

The answer of Antonio Mancini was first and ok.

But about the DUAL function: how would it look like if I use that one?

If I don't use the NUM function, the value 2016_3 is seen as text, i guess?

antoniotiman
Master III
Master III

Jharke,

however You can Use WeekName() function

WeekName(Date) -> 2016/04

This is Dual Field (Text and Number)

So, no problem with sort.

Regards,

Antonio

jharke
Creator II
Creator II
Author

Thanks, the result is the same indeed, and easier (only the '_' becomes a '/' )