Discussion Board for collaboration on QlikView Scripting.
Anyone can help me compute the number of months between two dates in the script.
It seems quite obvious but I can't manage to make this work so would appreciate your guidance.
Below an example of what I try to achieve:
- Start Date and End date are part of the original file
- NumberOfMonth is what I try to compute.
Many thanks for your helps!
Go to Solution.
load * inline [
Start Date, End Date
(Year([End Date])*12 + Month([End Date]))
(Year([Start Date])*12 + Month([Start Date]))
+ 1 as NumberOfMonth
DROP Table source;
=(Year([End Date])-Year([Start Date]))*12+(Month([End Date])-Month([Start Date]))
Jeff try below:
(Year(EndDate)*12 + Month(EndDate)) - (Year(StartDate)*12 + Month(StartDate)) + 1
(End_Year - Start_Year)*12 + (End_Month - Start_Month) + 1 as NumberOfMonths;
Year(Start_Date) as Start_Year,
Year(End_Date) as End_Year,
Month(Start_Date) as Start_Month,
Month(End_Date) as End_Month,
=((End_Year - Start_Year)*12 + (End_Month - Start_Month) + 1)