Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
Pls replace <Inv Date> with what holds the date in your app.
Pls use =Year([Inv Date])&'W'&Right(WeekName([Inv Date]),2) instead of the one above.....my date format was a bit different.
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.
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
this might work. Order date format: 'MM/DD/YYYY'
replace(WeekName(OrderDate),'/','W') as WeekNum,