Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
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