Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Guys
I have been looking at this for a few hours and need someone help to see that i'm doing work.
let tempdate='20110210'; // should be 478
//let tempdate='20091010'; // Should be -14 next test
trace $(tempdate);
trace today();
let CheckIfGreater = if (today()>$(tempdate),0,'Greater');
Let CalNumberOfYears = if (today()>$(tempdate),0,left($(tempdate),4)-year(today()));
Let CalNumberOfMonths = if (today()>$(tempdate),0,if (DayNumberOfYear($(tempdate))>DayNumberOfYear(today()),DayNumberOfYear($(tempdate))-DayNumberOfYear(today()),0));
Let CalNumberOfDays = if (today()>$(tempdate),0,if (DayNumberOfYear($(tempdate))<DayNumberOfYear(today()),DayNumberOfYear($(tempdate))-DayNumberOfYear(today())));
let Numberofexpdays2 = if (today()>$(tempdate),0,DayNumberOfYear($(tempdate))- DayNumberOfYear(today()));
trace $(Numberofexpdays2);
let Numberofexpdays = if (today()>$(tempdate),0,((left($(tempdate),4)-year(today()))*366 + if (DayNumberOfYear($(tempdate))<DayNumberOfYear(today()),DayNumberOfYear($(tempdate))-DayNumberOfYear(today()),DayNumberOfYear(today())-DayNumberOfYear($(tempdate)))));
trace $(Numberofexpdays);
And someone please see why i'm not getting the right value.
at present i'm getting
Numberofexpdays 712 but it should be 478 I think 😆
Ps i have also seen networkdays ('2007-02-19', '2007-03-01') returns 9 but i need to include saturday and sunday. Any ideas
Dates in QlikView (when represented properly as dates) are numbers, so it's just simple addition or subtraction.
let tempdate=makedate(2011,2,10);
let Numberofexpdays = tempdate - today(); // returns 474 for 24 Oct 2009
Thanks