Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Experts,
I am quite new to Qlikview. I have written some logic in incremental load and I am not getting any values when debug it.
Let vMaxMonth = Date(MonthEnd(Addmonths(Peek('MaxMonth',0,'Max_Date'),-1)),'MM/DD/YYYY hh:mm:ss:fff'); |
Let vMinMonth = Date(MonthStart(Addmonths(Peek('MaxMonth',0,'Max_Date'),-13)),'MM/DD/YYYY hh:mm:ss:fff'); |
Here MaxMonth is coming from max(field) from table.
I am not able to see any values for vMinMonth and vMaxMonth.
I am not able to debug where it is going wrong.
Thanks in advance
I think you should check this?
Not sure but you can try
Let vMaxMonth = TimeStamp(MonthEnd(Addmonths(Peek('MaxMonth',0,'Max_Date'),-1)),'MM/DD/YYYY hh:mm:ss:fff'); |
Let vMinMonth = TimeStamp(MonthStart(Addmonths(Peek('MaxMonth',0,'Max_Date'),-13)),'MM/DD/YYYY hh:mm:ss:fff'); |
or
Let vMaxMonth = Date(Floor(MonthEnd(Peek('MaxMonth',0,'Max_Date'),-1)))
Let vMinMonth = Date(Floor(MonthStart(Peek('MaxMonth',0,'Max_Date'),-13)))
Try this:
Let vMaxMonth = Date(MonthEnd(Addmonths(Peek('MaxMonth'),-1)),'MM/DD/YYYY hh:mm:ss:fff'); |
Let vMinMonth = Date(MonthStart(Addmonths(Peek('MaxMonth'),-13)),'MM/DD/YYYY hh:mm:ss:fff'); |
Please check format of max(field) .
if its date format then fine, or if its text ten we have convert the same into date format using date# function.
Regards,
Nilesh
Big trick to debug your assignments with nested function calls: start by figuring out which one of the nested calls produces unexpected values (like a NULL or something that isn't a date or a numerical value). Do simplify your expressions, or break them down in stages.
For example:
Let vMaxMonth1 = Peek('MaxMonth',0,'Max_Date');
Let vMaxMonth2 = Addmonths(Peek('MaxMonth',0,'Max_Date'),-1);
Let vMaxMonth3 = MonthEnd(Addmonths(Peek('MaxMonth',0,'Max_Date'),-1));
One of them will fail. Most probably the Peek() although I don't know for sure. Remember that both field and table names are case sesnsitive. Moreover Peek() won't complain if it can't find one of them.
Best,
Peter
Thanks to everybody for replying.
whatever the value will be coming in that variables with that I have to compare with timestamp(DD/MM/YYYY hh:mm:ss) format in further steps.
Here Max(field) is timestamp(DD/MM/YYYY hh:mm:ss).
Are you going to be testing equality (=) or greater than/less than (>, >=, <, <=)? Equality with timestamp won't be good idea. So if we are going to test greater than/less than, then I don't think you need the time component, unless you want to start from lets say Jan 1st 2016 9:30 pm instead of Jan 1st 2016 12:01 am.
Thanks Sunny for your quick reply.
Actually I am having greater than/less than (>, >=, <, <=)
I have like below.
Where visit_created_date >= '$(vMaxMonth)' and site_visit_created_datetime <='$(vMinMonth)'.
Where visit_created_datet < '$(vMinMonth)'.
Hi Peter,
I am getting date values. Can u look into this screen shot