For example the input Date is July 15, 2025 how can I create a formula that will get the previous Sunday and Monday of the given Date:
Input : July 15, 2025
Output:
Previous Sunday: July 13, 2025
Previous Monday: July 7, 2025
can you anyone help using the formula tool
thanks in advance
Solved! Go to Solution.
prev Sunday:
DateTimeAdd([InputDate], -ToNumber(DateTimeFormat([InputDate], "%w")), "days")
Prev Monday:
DateTimeAdd([InputDate], -(
IIF(ToNumber(DateTimeFormat([InputDate], "%w")) = 0,
6,
ToNumber(DateTimeFormat([InputDate], "%w")) - 1)
), "days")
@binuacs Thanks the formula for sunday is ok, but on the prev monay there is an issue, with regards to the parenthesis;
@grail0305 you could try this previous monday
DateTimeAdd([Date],
Switch(DateTimeFormat([Date],"%A"),Null(),"Monday",-7, "Tuesday",-8,"Wednesday",-9,"Thursday",-10,"Friday",-11,"Saturday",12,"Sunday",-12),
"day")
previous sunday
DateTimeAdd([Date],
Switch(DateTimeFormat([Date],"%A"),Null(),"Monday",-7, "Tuesday",-8,"Wednesday",-9,"Thursday",-10,"Friday",-11,"Saturday",-12,"Sunday",-13),
"day")
previous sunday
@grail0305 You missed the datetime add part
DateTimeAdd([InputDate], -(
IIF(ToNumber(DateTimeFormat([InputDate], "%w")) = 0,
6,
ToNumber(DateTimeFormat([InputDate], "%w")) - 1)
), "days")
User | Count |
---|---|
109 | |
88 | |
77 | |
54 | |
40 |