Forum Discussion
POSPOS
Post Partisan
1 year agoHow to exclude weekends with scheduled flows using Power Automate
Hi All, I have a requirement to schedule a Power BI report as a PPT to users every month on 15th. Requirement is to send on 15th of every month, but if 15th is a weekend (Saturday or Sunday) , then...
- 1 year ago
POSPOS Hello,
here's my proposal.
Recurence every day, then initialize variable as string with this inside of it:
if( and( not(equals(dayOfWeek(addDays(startOfMonth(utcNow()), 14)), 6)), not(equals(dayOfWeek(addDays(startOfMonth(utcNow()), 14)), 0)) ), formatDateTime(addDays(startOfMonth(utcNow()), 14), 'yyyy-MM-dd'), if( and( not(equals(dayOfWeek(addDays(startOfMonth(utcNow()), 15)), 6)), not(equals(dayOfWeek(addDays(startOfMonth(utcNow()), 15)), 0)) ), formatDateTime(addDays(startOfMonth(utcNow()), 15), 'yyyy-MM-dd'), if( and( not(equals(dayOfWeek(addDays(startOfMonth(utcNow()), 16)), 6)), not(equals(dayOfWeek(addDays(startOfMonth(utcNow()), 16)), 0)) ), formatDateTime(addDays(startOfMonth(utcNow()), 16), 'yyyy-MM-dd'), null ) ) )(code basically checks whether 15th, 16th or 17th is weekend and find the earliest non weekend day to run it).
This gonna check what's the valid day for the run in the current month.Then you have a condition that checks if today is that day and you then put the rest of your actions to the "TRUE" branch.
Sergii24
Super User
1 year agoHi POSPOS, I believe your question is more for Power Automate community rather than Power BI experts 🙂
You can post your question here - Microsoft Power Platform Community Forum Thread
However, what you want to do is:
- Indetify the day of the week (remember, Power Automate deals with dates in UTC time zone only!)
- If it's a weekend, add "delay" action until next Monday (you'd need to calculate the difference between the current time and the desired time on Monday (rememebr about UTC timezone! )
- then send ppt 🙂
Good luck with your flow 🙂