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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date formatting

Hello !

I think I remember that QlikView can formatting the date when we insert it from an excel file.

I have my date DD/MM/YYYY and I want to sort my data by day, month , year and week.

I know that for example if I want to sort by month I can write "date(monthstart(DATE),'MM/YYYY')"

But is it possible to count weeks (from 1 to 52) ?

Please help me ...

Annie

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

Annie,

I think there is no format code for week number, but you could try this:

=dual(WeekYear(Date) & ' / W' & week(Date) ,Weekstart(Date))

Hope this helps,

Stefan

View solution in original post

4 Replies
swuehl
Champion III
Champion III

Annie,

I think there is no format code for week number, but you could try this:

=dual(WeekYear(Date) & ' / W' & week(Date) ,Weekstart(Date))

Hope this helps,

Stefan

Not applicable
Author

Thank you it works !

I have a last question...

Actually I have my months like this : 01/2007 02/2007 ... 01/2008 02/2008

If I write this : "date(monthstart(Date),'MM/YYYY')", months are duplicate for the year.

Can I have only a list of month from 1 to 12 and clik on the year to have the right month.

swuehl
Champion III
Champion III

Yes, use month(Date) to retrieve these values.

Month() will also return a dual, so I think you will get something like 'Dec' if you type in =month(today()) in a text box, but '12' if you use a num() around: num(month(today())) or num(month(Date)))

Regards,

Stefan

Not applicable
Author

Thank you