Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Please find an example attached.
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
= ((year(date#('3/23/2015')) - year(date#('1/1/2014'))) * 12)
+
(Month(date#('3/23/2015')) - Month(date#('1/1/2014')))
Thanks!
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)