Skip to main content
Announcements
YOUR OPINION MATTERS! Please take the Qlik Experience survey you received via email. Survey ends June 14.
cancel
Showing results for 
Search instead for 
Did you mean: 
Panri93
Partner - Contributor II
Partner - Contributor II

How do I get the difference in months between 2 dates that are in different format?

Hi everyone!

I'm new at Qlik. I was wondering how to obtain the difference in months between two dates that are in different formats. For example:

Date 1:  13/06/2020 (DD/MM/YYYY)

Date 2: 2020/05 (YYYY/MM)

For the example above, I should obtain 1 month.

Note: Both fields are in date format so no conversion is needed.

Any idea?

 

 

3 Replies
anat
Master
Master

month(date(date#('13/06/2020','DD/MM/YYYY'),'MM/YYYY'))-month(date(date#('2020/05','YYYY/MM'),'MM/YYYY'))

else u can try below link method

Solved: Count number of months between two dates - Qlik Community - 1540620

 

MarcoWedel

12*(Year(Date1)-Year(Date2))+Month(Date1)-Month(Date2)
Harvey
Contributor
Contributor


@ToysRUSCreditCard wrote:

Hi everyone!

I'm new at Qlik. I was wondering how to obtain the difference in months between two dates that are in different formats. For example:

Date 1:  13/06/2020 (DD/MM/YYYY)

Date 2: 2020/05 (YYYY/MM)

For the example above, I should obtain 1 month.

Note: Both fields are in date format so no conversion is needed.

Any idea?

 

 


Try: Month(Date#(End_date,'DD-MM-YYYY'))-Month(Date#(Start_date,'DD-MM-YYYY'))

((year(Date#('31-02-2019','DD-MM-YYYY'))*12)+month(Date#('31-02-2019','DD-MM-YYYY'))) - (((year(Date#('01-01-2018','DD-MM-YYYY'))*12)+month(Date#('01-01-2018','DD-MM-YYYY'))))