Date Filter

Hi everyone

I am using below formula in Filter Menu

Year([ErpInventoryReceipt.Fiş Tarihi])==2022 && Month([ErpInventoryReceipt.Fiş Tarihi]) >0

But I have to manually change the month and year parts

How can I give 2 months filter backwards from today

Like This

Mont(Today)-2 Month

Comments

  • Hello!

    To filter the DataBand dynamically for the last 2 months from the current date (without hard-coded years and months), use C# date arithmetic with `DateTime.Today.AddMonths(-2)` in `DataBand.Filter`:

    (DateTime)[Table.DocDate] >= DateTime.Today.AddMonths(-2)

    (Or via the built-in report function: [Table.DocDate] >= AddMonths(Date, -2) if the column is already typed as DateTime.)

This discussion has been closed.