Filter for previous month
-
- Posts: 22
- Joined: Sun Apr 03, 2016 2:09 pm
Filter for previous month
Hello,
I am having trouble figuring out how to filter my reports to only show the previous month.
For instance, today is February 22nd. If I run my report it should only show records from Jan 1 - Jan 31. If I run the same report on March 22nd, it should only show Feb 1 - Feb 28, etc.
I know in the databand I can filter between two dates, but is there an easier way? Something like: Today.PreviousMonth?
Thanks,
David
EDIT:
I've created the following three variables:
startOfThisMonth = DateSerial(Today.Year, Today.Month, 1);
firstDay = startOfThisMonth.AddMonths(-1);
lastDay = startOfThisMonth.AddDays(-1);
I then use the Databand filtering to filter the DateTime field using the expression editor for 'between' firstDay and lastDay
When I select preview I receive: "Error - Error #1085"
I am having trouble figuring out how to filter my reports to only show the previous month.
For instance, today is February 22nd. If I run my report it should only show records from Jan 1 - Jan 31. If I run the same report on March 22nd, it should only show Feb 1 - Feb 28, etc.
I know in the databand I can filter between two dates, but is there an easier way? Something like: Today.PreviousMonth?
Thanks,
David
EDIT:
I've created the following three variables:
startOfThisMonth = DateSerial(Today.Year, Today.Month, 1);
firstDay = startOfThisMonth.AddMonths(-1);
lastDay = startOfThisMonth.AddDays(-1);
I then use the Databand filtering to filter the DateTime field using the expression editor for 'between' firstDay and lastDay
When I select preview I receive: "Error - Error #1085"
Re: Filter for previous month
Hello,
Please send us a simple report with test data which reproduces the issue for analysis.
Thank you.
Please send us a simple report with test data which reproduces the issue for analysis.
Thank you.
-
- Posts: 22
- Joined: Sun Apr 03, 2016 2:09 pm
Re: Filter for previous month
Aleksey wrote:Hello,
Please send us a simple report with test data which reproduces the issue for analysis.
Thank you.
Thanks for your time, find the attached report.
David
- Attachments
-
- LastMonthAttempt.mrt
- (14.72 KiB) Downloaded 285 times
-
- Posts: 22
- Joined: Sun Apr 03, 2016 2:09 pm
Re: Filter for previous month
Aleksey wrote:Hello,
Please send us a simple report with test data which reproduces the issue for analysis.
Thank you.
I don't necessarily have to use the method seen in that report. If there is a better way of filtering to only show records from the previous month then I am definitely open to that.
Thanks again for your time,
David
Re: Filter for previous month
Hello, David.
Please, try to change the Field Is to Expression in the Filter and write your own expression for the filtering.
Thank you.
Please, try to change the Field Is to Expression in the Filter and write your own expression for the filtering.
Thank you.
-
- Posts: 22
- Joined: Sun Apr 03, 2016 2:09 pm
Re: Filter for previous month
HighAley wrote:Hello, David.
Please, try to change the Field Is to Expression in the Filter and write your own expression for the filtering.
Thank you.
Thanks for the reply. So I have removed the above variables and in the databand filter, I am filtering between:
DateSerial(Today.Year, Today.Month, 1).AddMonths(-1)
and
DateSerial(Today.Year, Today.Month, 1).AddDays(-1)
And I am still receiving the same error message. Any ideas?
Re: Filter for previous month
Hello.
There should be a C# expression.
It should be like next:
Thank you.
There should be a C# expression.
It should be like next:
Code: Select all
Table1.InventoryHistoryQuantityChange > DateSerial(Today.Year, Today.Month, 1).AddMonths(-1) && Table1.InventoryHistoryQuantityChange < DateSerial(Today.Year, Today.Month, 1).AddDays(-1)
-
- Posts: 22
- Joined: Sun Apr 03, 2016 2:09 pm
Re: Filter for previous month
HighAley wrote:Hello.
There should be a C# expression.
It should be like next:
Thank you.Code: Select all
Table1.InventoryHistoryQuantityChange > DateSerial(Today.Year, Today.Month, 1).AddMonths(-1) && Table1.InventoryHistoryQuantityChange < DateSerial(Today.Year, Today.Month, 1).AddDays(-1)
Hi HighAley,
Thanks again for your response. So I have tried this and I am still receiving 'Error #1085".
Also, I've tried applying that expression to filter the Table1.InventoryHistoryQuantityChange field, but I believe we should be filtering the Table1.InventoryHistoryHistoryDateTime field no? Either way, I tried applying the filtering to both fields, and receive the same error either way

Any ideas?
- Attachments
-
- LastMonthAttempt2.mrt
- (15.46 KiB) Downloaded 268 times
-
- Posts: 22
- Joined: Sun Apr 03, 2016 2:09 pm
Re: Filter for previous month
davidanthonyb wrote:HighAley wrote:Hello.
There should be a C# expression.
It should be like next:
Thank you.Code: Select all
Table1.InventoryHistoryQuantityChange > DateSerial(Today.Year, Today.Month, 1).AddMonths(-1) && Table1.InventoryHistoryQuantityChange < DateSerial(Today.Year, Today.Month, 1).AddDays(-1)
Hi HighAley,
Thanks again for your response. So I have tried this and I am still receiving 'Error #1085".
Also, I've tried applying that expression to filter the Table1.InventoryHistoryQuantityChange field, but I believe we should be filtering the Table1.InventoryHistoryHistoryDateTime field no? Either way, I tried applying the filtering to both fields, and receive the same error either way
Any ideas?
I've also tried applying the filter in one single expression using the && operator as suggested and this too results in the same error :/
- Attachments
-
- LastMonthAttempt3.mrt
- (15.4 KiB) Downloaded 317 times
Re: Filter for previous month
Hello,
Please check the modified report in the attachment.
Thank you.
Please check the modified report in the attachment.
Thank you.
- Attachments
-
- LastMonthAttempt3_modified.mrt
- (15.89 KiB) Downloaded 385 times