Getting The No. of months between subsequent Posting Dates
                
                    Freaky                
                
                    Member Posts: 125                
            
                        
            
                    Hi Guys,
I designed a report to print out Posting dates of a customer with payments and arrears.
Now, what I want is to be able to get the difference between subsequent months. Please take a look below
Months
29/02/08
03/04/08
21/05/08
18/06/08
17/09/08
Desired Result
No. of Months
0
2
1
1
3
Please can anyone help me on this.
Thanks.
                I designed a report to print out Posting dates of a customer with payments and arrears.
Now, what I want is to be able to get the difference between subsequent months. Please take a look below
Months
29/02/08
03/04/08
21/05/08
18/06/08
17/09/08
Desired Result
No. of Months
0
2
1
1
3
Please can anyone help me on this.
Thanks.
0                
            Answers
- 
            Have you considred using the DATE2DMY function?0
 - 
            And what is wrong with your calculations? Is this the result of your code or the desired results?
Have you looked at the DATE2DMY function or using the virtual date table?0 - 
            Sorry did not make it clear the No. of Months is my desired result. That is what I cannot figure out how to get.
Thanks.0 - 
            So? Start investigating our suggestions and come back with some C/AL code if you cannot get it to work.
This website is not a free development site, we give hints and you should be able to figure out yourself what to do and learn in this process.
Good luck!0 - 
            ok I did work onthe following code though not bad but did not give me what i want.
START :=("Cust. Ledger Entry"."Posting Date"); IF "Cust. Ledger Entry1".NEXT() <> 0 THEN BEGIN enddate :=("Cust. Ledger Entry1"."Posting Date"); diff := ABS(enddate - START); END ELSE BEGIN diff:= 0; END;
the diff variable gives me the difference in days which I can convert to months
Dates
01/01/2007
31/03/2007
29/10/2007
30/11/2007
24/12/2007
31/01/2008
29/02/2008
diff
0
145
> This is the only wrong figure am getting
212
32
24
38
29
The 145 days should be about 60 days. Can you guys help in figuring it out. Please.
Thanks.0 - 
            And what if you replace your calculation with the DATE2DMY statement?0
 - 
            Thanks guys I was enable to figure get it using the DATE2DMY FUNCTION.
=D>0 - 
            
 - 
            Glad to have been able to help you. Good luck.
BTW: great that you changed the status to solved as so many fellow mibuso-ers seem to forget to do that.0 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.7K Microsoft Dynamics NAV
 - 18.7K NAV Three Tier
 - 38.4K NAV/Navision Classic Client
 - 3.6K Navision Attain
 - 2.4K Navision Financials
 - 116 Navision DOS
 - 851 Navision e-Commerce
 - 1K NAV Tips & Tricks
 - 772 NAV Dutch speaking only
 - 617 NAV Courses, Exams & Certification
 - 2K Microsoft Dynamics-Other
 - 1.5K Dynamics AX
 - 323 Dynamics CRM
 - 111 Dynamics GP
 - 10 Dynamics SL
 - 1.5K Other
 - 990 SQL General
 - 383 SQL Performance
 - 34 SQL Tips & Tricks
 - 35 Design Patterns (General & Best Practices)
 - 1 Architectural Patterns
 - 10 Design Patterns
 - 5 Implementation Patterns
 - 53 3rd Party Products, Services & Events
 - 1.6K General
 - 1.1K General Chat
 - 1.6K Website
 - 83 Testing
 - 1.2K Download section
 - 23 How Tos section
 - 252 Feedback
 - 12 NAV TechDays 2013 Sessions
 - 13 NAV TechDays 2012 Sessions
 

