Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have created a variable
LET vRepWeek = WeekName(Today());
It creates a value 2015/38 for the current week.
I am trying to compare this date to a LastSaleWeek created in my script
WeekName(Max(WeekName)) as LastSaleWeek,
I am trying to compute the difference between these two values.
Problem is that the VRepWeek is being interpreted by Qlikview as a number 53.0262 ie 2015 divided by 38 (2015/38).
As you can see, the two fields have different formats.
Any suggestions?
Try
=WeekName(Today(1))- weekname(makedate(SubField('2014/02','/',1)),SubField('2014/02','/',2))
hth
Sasi
when I manage weeks and Year I use to write expression like:
WeekYear(myDate)*100 + Week(myDate)
this expression returns the number 201538 that can be managed easily ...
Thanks Alessandro.
I actually do something similar in Excel.
But us 201538 a number?
How would this work across multiple years? If I wanted to establish the interval between 201438 and 201505, how would this compute?
Regards
Joe
Only an idea ... use the starting dates of weeks then make a difference between 2 dates and divide by 7:
Suppose that the date (DT1) 17 Sep 2014 gives you the week 201438 and (DT2) 28 Jan 2015 is the 201505 then
(WeekStart(DT2) - WeekStart(DT1))/7 returns the number of weeks between the two.
let me know
Possibly you are using $ expansion to that variable which is then converting the texual presentation to evaluated number. Try without $ with variable.
Try
=WeekName(Today(1))- weekname(makedate(SubField('2014/02','/',1)),SubField('2014/02','/',2))
hth
Sasi
Hi
Thank you for your response.
When I drop the dollar expansion, the script does not seem to recognise the variable.
Is there a particular syntax I should be using?
Regards
Joe
Could you share your qvw sample?