Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends,
I have declared a variable like this
LET vAccountingPeriod=Date#(ADDMONTHS(YEARSTART(Now()),-12),'YYYYMM');
Which is equal to 201401.
and loaded the data like
Load * from table
where Date#([Acct-PrdOO],'YYYYMM')>Date#($(vAccountingPeriod),'YYYYMM');
But I am getting all the data and the check condition is failing.
Please let me know the error in the code.....
Thanks
Try:
LET vAccountingPeriod= floor(ADDMONTHS(YEARSTART(Now()),-12));
Load * from table
where floor(Date#([Acct-PrdOO],'YYYYMM')) > $(vAccountingPeriod);
As you have already set the format in the variable, you should be able to just use
where Date#([Acct-PrdOO],'YYYYMM')>'$(vAccountingPeriod)';
hope that helps
Joe
Try:
LET vAccountingPeriod= floor(ADDMONTHS(YEARSTART(Now()),-12));
Load * from table
where floor(Date#([Acct-PrdOO],'YYYYMM')) > $(vAccountingPeriod);
Hi Gysbert
Its working!!! Could I know the reason please
When using dates in comparisons it's often wise to use only the numeric value and not mess around with the different format string representations of the dates.