Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Months Between Two Dates

Hi, I'm a bit new at QV and would like to calculate months between two dates. Struggling a bit to write this...

=if(EXIT_DATE Isnull then addmonths_between(ENTRY_DATE and TODAY())

else

addmonths_between (ENTRY_DATE and EXIT_DATE)

2 Replies
mdmukramali
Specialist III
Specialist III

devarasu07
Master II
Master II

Hi,

try like this,

set  variable like below,

SET MonthDiff = Num(((year($2) * 12) + month($2)) - (((year($1) * 12) + month($1))) + 1);

load *,  $(MonthDiff(FromDate, ToDate)) AS MonthsDifference;

load * Inline [

FromDate,ToDate

2017-01-25,2017-09-19

2016-02-25,2017-03-19

];

Capture.JPG