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: 
Not applicable

Date Difference between two field

Dear All,

I'm new in qlikview. Need your help to solve this issue. Please find my problem from below:

I have two date fields in String format. I will convert them into date formate "MM/YY". After convert into date formate then i will find out no of month between two fields.

Exp: Lot_month: 03/12 and to_moth_year: 03/15. Difference between two field will be 36 month. Please help me to write down the expression.

Regards,

Masba

1 Solution

Accepted Solutions
maxgro
MVP
MVP

the difference of years *12 + the difference of months

replace with your fields

= (right('03/15' ,2) - right('03/12',2))*12 +  (left('03/15' ,2) - left('03/12',2)) 

--> 36

View solution in original post

4 Replies
danieloberbilli
Specialist II
Specialist II

Please find an example attached.

maxgro
MVP
MVP

the difference of years *12 + the difference of months

replace with your fields

= (right('03/15' ,2) - right('03/12',2))*12 +  (left('03/15' ,2) - left('03/12',2)) 

--> 36

Not applicable
Author

= ((year(date#('3/23/2015')) - year(date#('1/1/2014'))) * 12)
+
(Month(date#('3/23/2015')) - Month(date#('1/1/2014')))

Thanks!

Not applicable
Author

Hi,

You can try this logic.

In script,

Date(Date#(StringDatefield,'MMM/YY'),'MM/YY') as First,

Date(Date#(StringDatefield,'MMM/YY'),'MM/YY') as Last

In text object can use below one.

= (Last-First)/(365/12)