Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
Need help in writing a expression in a chart ,which count the number of months b/w Date1 and Date2
Thanks
Please try this:
((year(Date#('31-02-2019','DD-MM-YYYY'))*12)+month(Date#('31-02-2019','DD-MM-YYYY'))) - (((year(Date#('01-01-2018','DD-MM-YYYY'))*12)+month(Date#('01-01-2018','DD-MM-YYYY'))))
Try: Month(Date#(End_date,'DD-MM-YYYY'))-Month(Date#(Start_date,'DD-MM-YYYY'))
Thanks Anushree,
some issue in the expression
Month(Date#('31-02-2019','DD-MM-YYYY'))-Month(Date#('01-01-2019','DD-MM-YYYY'))
Count=2 which is right
Month(Date#('31-02-2019','DD-MM-YYYY'))-Month(Date#('01-01-2018','DD-MM-YYYY'))
Count =2 which is wrong suppose to be more than 2
Please try this:
((year(Date#('31-02-2019','DD-MM-YYYY'))*12)+month(Date#('31-02-2019','DD-MM-YYYY'))) - (((year(Date#('01-01-2018','DD-MM-YYYY'))*12)+month(Date#('01-01-2018','DD-MM-YYYY'))))
Thanks ,it worked ,can u plz help me in understanding ur expression ,y do we need multiple year with 12
Multiplying years from both From and End Date is essential to track the years in hand supposedly from and to both are same years you will see the difference in months in case they are different an additive 12 is required for the difference in months .
If its not clear just take 2 different years and do the math like 2000 - 02 Vs 2002 -05 so when i multiply 2 ;Month difference between 2 Years is 24 (2002 -2000->2 Yrs ->24 Months)+Difference in Months 5-2->3
So now its 24+3=27
Hope this is clear