Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a requirement to calculate date range moving forward. Currently I have data for current date and need to limit it to max of 6 months. I am making use of where Datefield<=AddMonths(Today(),6). The problem is currently I have data for Day1 and will keep adding data. Once the maxdate is reached the mindate should move to the next date. I am not sure how to accomplish this. Any help/suggestions is greatly appreciated.
Hi,
The logic will work because it says that the table or chart should have data from six month back from today.
If you want to restrict the data at load time you can try something like this.
Load Field1, Field2, Field3....
From XYZ
where DateField >= Monthstart(Addmonths(today(),-6));
Here the expression Monthstart(Addmonths(today(),-6)) will return 1/2/2012. And in where clause you are saying that load the data where the Datefield is Greater than 1/2/2012.
So even though you are starting the data load from today it will work.
Hope the idea is clear.
Regards,
Kaushik Solanki
HI,
Do you mean you want to look at only the latest 6 months Data? If yes then the logic is as follows.
your datefield > = monthstart(addmonths(today(),-6))
Hope this will help.
Regards,
Kaushik Solanki
Thanks Kaushik for getting back.The logic you have mentioned can be used once I reach the 6 month data. Currently I am having Day1 data and if I use this now then it would reload from today's system date moving forward, as I do a daily reload this logic will fail. Hope I am making some sense.
Thanks,
Mak
Any ideas? Anyone?
Hi,
The logic will work because it says that the table or chart should have data from six month back from today.
If you want to restrict the data at load time you can try something like this.
Load Field1, Field2, Field3....
From XYZ
where DateField >= Monthstart(Addmonths(today(),-6));
Here the expression Monthstart(Addmonths(today(),-6)) will return 1/2/2012. And in where clause you are saying that load the data where the Datefield is Greater than 1/2/2012.
So even though you are starting the data load from today it will work.
Hope the idea is clear.
Regards,
Kaushik Solanki
Kaushik,
I get the logic now, I was seeing it in differently. Thanks for the help.
Regards,
Mak