Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am trying to compare two date values ,one date is coming from Created Date field and another date is Variable date which we hard coded. Both field date and Variable date also in same format
Let vCreationDate = date('2/1/2015')
this is the condition I am trying to compare but not able to get the correct result.
if([Created Date] > $(vCreationDate),'0',BW)
Thanks
You need to make sure that both variable and field will be recognized as date:
Let vCreationDate = date(date#('2/1/2015', 'M/D/YYYY'), 'M/D/YYYY');
and then: if([Created Date] > '$(vCreationDate)','0',BW)
but better is always to compare pure numeric values:
Let vCreationDate = num(date#('2/1/2015', 'M/D/YYYY'));
and then: if(num([Created Date])> $(vCreationDate),'0',BW)
see also: How to use - Master-Calendar and Date-Values
- Marcus
Hi,
Where you are comparing this? In script or in Set Analysis?
Regards,
Jagan.
in script level jagan mohan
You need to make sure that both variable and field will be recognized as date:
Let vCreationDate = date(date#('2/1/2015', 'M/D/YYYY'), 'M/D/YYYY');
and then: if([Created Date] > '$(vCreationDate)','0',BW)
but better is always to compare pure numeric values:
Let vCreationDate = num(date#('2/1/2015', 'M/D/YYYY'));
and then: if(num([Created Date])> $(vCreationDate),'0',BW)
see also: How to use - Master-Calendar and Date-Values
- Marcus
Hi,
Try like this
Let vCreationDate = Date(Date#('2/1/2015', 'M/D/YYYY'), 'M/D/YYYY');
Note: change this format accordingly M/D/YYYY or D/M/YYYY
LOAD
*,
If([Created Date] > '$(vCreationDate)','0',BW) AS NewFieldName
FROm Datasource;
Hope this helps you.
Regards,
Jagan.