Get Previous Monday Date Formula

1 Answer 28 Views
Report Designer (standalone) Report Parameters
Brandon
Top achievements
Rank 1
Brandon asked on 14 Jan 2024, 02:43 PM

Hello,

Looking for a formula to get the previous Monday and Sunday dates for default report parameters. I assume something similar to this but cannot get figure it out. 

Formula below is the last day of the year. I can't figure out how to make it previous Monday. 

= Today().AddDays(CDbl(- Today().Day))

 

Thanks in advanced

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 17 Jan 2024, 03:15 PM

Hello Brandon,

You may try using the following formula to get the previous Monday:

= (AddDays(Today(), - (CInt(Today().DayOfWeek) - 1) - 7)).ToString("MM/dd/yyyy")
 

For the previous Sunday, you may change the highlighted number to 8 in the expression.

I hope this will help.

Regards,
Dimitar
Progress Telerik

Stay tuned by visiting our roadmap and feedback portal pages, enjoy a smooth take-off with our Getting Started resources, or visit the free self-paced technical training at https://learn.telerik.com/.
Brandon
Top achievements
Rank 1
commented on 17 Jan 2024, 03:55 PM

Perfect! That works.

I was looking for the previous Sunday,  our weeks or Monday-Sunday, so highlighted -7 to -1 works.  

= (AddDays(Today(), - (CInt(Today().DayOfWeek) - 1) - 1)).ToString("MM/dd/yyyy")
Tags
Report Designer (standalone) Report Parameters
Asked by
Brandon
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or