
Announcements
I have a interesting problem. I want to use a date picker and if date is a Monday then subtract three days where the resultant day would be a Friday.
I have a business scenario that calls for the date picker to -1 days, but not to fall on a weekend.
Here is my attempted formula (it has errors).
I am trying to write an IF ELSE
Pseudocode explanation: If day is Monday then subtract three days. ELSE subtract one day
If(Weekday(DataCardValue8.SelectedDate),2,DateAdd(DataCardValue8.SelectedDate,-3))
else DateAdd(DataCardValue8.SelectedDate,-1)
My attempt at using the Weekday() function was to isolate the day of the week as Monday which was designated by the 2.
Can someone look at my formula and fix both the IF ELSE statement and the logic? I'm stumped. Thanks.
Hi @adove ,
Try this
With(
{_Date: DataCardValue8.SelectedDate},
DateAdd(
_Date,
If(
Weekday(_Date) = 2,
-3,
-1
)
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps