Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to add a DateDiff in the load script

Hi

Apologies, I'm a newbie to QV!!

I'm trying to add a DateDiff field in the load script, as the piece of code below is giving me nulls,1,2 and3+ but nothing in the 3 group and I just want to see why.

The DateDiff needed is a fixed date of 01-Nov-10 - {ACW Last Requal Date], would anyone be able to point me in the right direction please?

Thanks

Nic

If(IsNull([ACW Last Requal Date]),'',

If('01/11/2010'-[ACW Last Requal Date] < '366','1',

If('01/11/2010'-[ACW Last Requal Date] < '731','2',

If('01/11/2010'-[ACW Last Requal Date] < '1096','3',

If('01/11/2010'-[ACW Last Requal Date] > '1095','+3'))))) AS [ACW Last Requal Year],

2 Replies
vgutkovsky
Master II
Master II

Your syntax is mostly right, just change it to: If(date#('01/11/2010','DD/MM/YYYY') - [ACW LAST Requal Date] etc.

hector
Specialist
Specialist

Hi, my version is with makedate()


If(makedate(2010,11,1) -[ACW Last Requal Date .........


By the way, it seems you are trying to generate "years of something" (LOL xD), maybe you can use an intervalmatch() instead of nested if's

Rgds