Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Guys:
I have a simple question but not able to get a simple solution.
Hope that guys here are able to help me out…
Here goes….
I am trying to set the To_Date to 16/05/2011.
That mean that every time the users open the Qlikview report it will show To_Date as 16/05/2011 and the users can change that date after that.
From_ Date will show the Current date.
My Edit script show as follows:-
Let DashboardstartDate = date(today(),'DD-MM-YYYY')-15;
The -15 is the week from the Current Date.
How do I set the To_Date to 15/05/2011 as a default date?
Thanks a lot guys for any input..
Let DashboardstartDate = Makedate(2011,05,16);
use the above
hope this helps
Hi Sunil:
Thanks for your reply.
I try your script
Let DashboardstartDate = Makedate(2011,05,16);
And the To_Date show 30/12/1899.
The date looks very funny as I have no data in year 1899…
I try to change the script to
Let DashboardstartDate = Makedate(16,05,2011);
But there is an error.
Not sure what went wrong….
use
Let DashboardstartDate=makedate( 2011,05,16)
instead of
Let DashboardstartDate = Makedate(16,05,2011);
wwill give your 16/05/2011 if ur date format is dd/mm/YYYY
syntax makedate is Makedate(year,Month,date)
You can use
Let DashboardstartDate = Date(Today()-15,'DD-MM-YYYY');
to set the date - 15 days, but if you want set date - 15 WEEKS, you can use
Let DashboardstartDate = Date(WeekName(Today(),-15),'DD-MM-YYYY');
anyway, if you want to put the value in a field called TO_DATE, you have to select the value of the variable in that field when the users open the doc. Do that with an action:
Settings --> Document Properties --> Triggers --> OnOpen --> Add Action --> Add --> Selections --> Select In Field --> OK
Then you can put the field where you can make the select and the search string. The select string will be
=Date(DashboardstartDate)
Hi Sunil;
I try the script:-
Let DashboardstartDate=makedate( 2011,05,16);
And the To_date still shows 30/12/1899
I am still thinking what might have gone wrong.
It should show 16/05/2011 for the To_Date when the user open the report.
Could you please let me know where I might have gone wrong?
Below is some of the script:-
SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$#,##0.00;($#,##0.00)';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='DD/MM/YYYY';
SET TimestampFormat='DD/MM/YYYY';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET Today = today(); // Todays date, format YYYY-MM-DD
Let Startdate = year(today(0)-1) & num(month(today(0)-1),'00') & num(day(today(0)-1),'00');
Let CurrYr = year(today());
Let CurrentYearWeek = year(today()) & num(week(today()),'00');
Let varcurrYearMonth = year(varcurrdate) & num(month(varcurrdate));
Let DashboardstartDate = date(today(),'DD-MM-YYYY')-15;// FOR DISPLAY 1 DAY EARLIER SALES
//Let [From Date] = date($(DashboardstartDate));
Let CurrentDate = date($(PrvDate));
Let Startdate = year(today(0)-1) & num(month(today(0)-1),'00') & num(day(today(0)-1),'00');
SET HIDEPREFIX = %;
SET Today = today(); // Todays date, format YYYY-MM-DD
Let TodayDate = date(today(),'DD-MM-YYYY');
Let PrvDate = date(today(),'DD-MM-YYYY')-1;// FOR DISPLAY 1 DAY EARLIER SALES
//Let DashboardstartDate = date(today(),'DD-MM-YYYY')-15;// FOR DISPLAY 1 DAY EARLIER SALES
Let DashboardstartDate=makedate( 2011,05,05);
Let [From Date] = date($(DashboardstartDate));
Let CurrentDate = date($(PrvDate));
Let CurrYr = year(today()) -1;
Let LastWeek = (weekstart(TodayDate,-1));
Let Last12Week = (weekstart(TodayDate,-12));
Let CurrentYearWeek = year(LastWeek) & num(week(LastWeek),'00');
Let FromYearWeek = year(Last12Week) & num(week(Last12Week),'00');
Let DashboardstartWeek = year(Last12Week) & num(week(Last12Week),'00');
//Let CurrentYearWeek = year(today()) & num(week(Today()),'00');
Let LastMonth = (addmonths(TodayDate, -1));
Let CurrentYearMonth = year(LastMonth) & num(month(LastMonth),'00');
Let Last12Month = (addmonths(TodayDate, -12));
Let FromYrMth = year(Last12Month) & num(month(Last12Month),'00');
Let DashboardstartMonth = year(Last12Month) & num(month(Last12Month),'00');
LET Enddayinmonth = monthend(today());
Thanks alot
see the attached file .
and let mee knoww if u have any concern
Discovered this post today, while trying to resolve a similar issue. Encountered issues with obscure dates being reported as well, in my case it was related to date formatting, so FWIW ... here's an exerpt from my script, where I got the date formatting correct for my purposes using the Date#() function.
Let DashboardstartDate = Year(Addmonths(Today(), -1) ) & Num(Month(Addmonths(Today(), -1)),'00') & Num(01,'00'); // default date for dashboard = start of previous month
Let [From Date] = Date(Date#($(DashboardstartDate),'YYYYMMDD'));