Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Jose_
Contributor
Contributor

Jose_.

Hola buenos días,

 

Estoy realizando un ciclo for y no he logrado encontrar la forma para calcular la cantidad de meses entre dos fechas y esta me pueda generar qvds independientes.

Agradezco su ayuda.

Labels (4)
1 Solution

Accepted Solutions
anthonyj
Creator III
Creator III

Hi @Jose_ ,

Here's two ways you can calculate the number of months.
You can calculate the number of days between the dates and get a decimal value of the period.
(((Date2 - Date1)*12)/365.25)
or
You can round the months and calculate the differences between them.
(year(Date2)+(month(Date2)*12))-(year(Date1)+(month(Date1)*12))
This is how the monthdiff() function works in the "R" program

You can try both options and see which might suit your needs.

Regards

Anthony

View solution in original post

2 Replies
anthonyj
Creator III
Creator III

Hi @Jose_ ,

Here's two ways you can calculate the number of months.
You can calculate the number of days between the dates and get a decimal value of the period.
(((Date2 - Date1)*12)/365.25)
or
You can round the months and calculate the differences between them.
(year(Date2)+(month(Date2)*12))-(year(Date1)+(month(Date1)*12))
This is how the monthdiff() function works in the "R" program

You can try both options and see which might suit your needs.

Regards

Anthony

Jose_
Contributor
Contributor
Author

thank you very much i will check it