Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count of month

Hello,

I have a problem in counting the number of months.

So, i have an install date with this format: MM/YYYY and a uninstall date with the same format MM/YYYY.

For example: install date = 01/2009 and uninstall date = 03/2010. Mathematically speaking is 15 months for that machine in that location(this is what i need).

I have to count number of months that are resulting from: (uninstall date - install date).

Can you help me please. i don't know how to do this.

Thank you in advance.

1 Solution

Accepted Solutions
erichshiino
Partner - Master
Partner - Master

Hi,

Try this:

(year(date2) - year(date1))*12 + month(date2)-month(date1)

This should work, even if the dates are 03/2010 and 08/2009Erich

Rgds,


View solution in original post

2 Replies
erichshiino
Partner - Master
Partner - Master

Hi,

Try this:

(year(date2) - year(date1))*12 + month(date2)-month(date1)

This should work, even if the dates are 03/2010 and 08/2009Erich

Rgds,


Not applicable
Author

Thank you very much. It worked. But i have other situation: uninstall date is 12/9999 and the diference for ones that have 12/9999 as uninstall date has to be for example:

install date=03/2009 and uninstall date = 12/9999.

For me this machine has only 2 months of being used in that location, because we are in month 04 .

How do I use the formula above in this case?

Best Regards,

Oana.