Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date format code that gives week number?

Does anyone know if I can get a week number from a QlikView date format code?   Maybe something like  2011W43  for the 43rd week of 2011 ?  I know there's a Week function that returns week number but I'd like to use a date format code so that I can avoid adding another expression to a big chart.

6 Replies
Not applicable
Author

try something like =Year([Inv Date])&'W'&Left(WeekName([Inv Date]),2) to get the result in the format YYYYW##.....if that works for you

Not applicable
Author

Pls replace <Inv Date> with what holds the date in your app.

Not applicable
Author

Pls use =Year([Inv Date])&'W'&Right(WeekName([Inv Date]),2) instead of the one above.....my date format was a bit different.

Not applicable
Author

Thanks for the reply.  I was looking for a date format code not an expression. Oracle has a week of the year code that can be used like this     TO_CHAR(MYDATECOLUMN,'WW').  If I had a date format code then I could put it into the Document Properties Number tab and when I use the field in a chart dimension it wouldn't be a calculated dimension. I would need a calculated dimension in order to use an expression in the chart dimension and I wanted to avoid that for performance reasons.  I may try loading a small table of dates and week of year field and give the user a cycle group to choose between the regular date or a week of the year date.   Thanks.

swuehl
MVP
MVP

Tim,

if it's all about avoiding the calculated dimension, why not add a field to your datamodel, with the date formatted like JasleenP_SR suggested?

Regards,

Stefan

Not applicable
Author

this might work. Order date format: 'MM/DD/YYYY'

replace(WeekName(OrderDate),'/','W') as WeekNum,