Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
POSPOS
Post Patron
Post Patron

How 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 the flow should run on the next week day, i.e., if 15th is Saturday then flow should run on 17th and if 15th is Sunday, then flow should run on 16th.
Can someone please suggest on how this can be achieved.
 
This is the current flow I have:
POSPOS_1-1730823298731.png

 

1 ACCEPTED SOLUTION
vojtechsima
Resident Rockstar
Resident Rockstar

@POSPOS Hello,

here's my proposal.

vojtechsima_0-1730839253436.png

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.

View solution in original post

5 REPLIES 5
vojtechsima
Resident Rockstar
Resident Rockstar

@POSPOS Hello,

here's my proposal.

vojtechsima_0-1730839253436.png

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.

Relay9
Regular Visitor

Hi @POSPOS 
1.
Recurrence Trigger: Set the recurrence trigger to run on the 15th of every month.

2. Condition to Check Day of the Week:

• After the “Recurrence” step, add a condition to check the day of the week.

• Use the dayOfWeek function to get the day. dayOfWeek(utcNow()) returns an integer (0 for Sunday, 1 for Monday, …, 6 for Saturday).

3. Branch Conditions:

• If dayOfWeek(utcNow()) == 6 (Saturday), add a delay or calculate the next weekday (17th).

• If dayOfWeek(utcNow()) == 0 (Sunday), schedule it to run the next day (16th).

4. Run Export and Email Steps:

• For each condition, add the “Export to File for Power BI Reports” and “Send an email” actions in the correct branch.

5. Fallback (Optional):

• In case the 15th is a weekday, directly proceed with the “Export to File” and “Send an email” actions without any delay.

 

This will ensure that your flow sends the report on the 15th or the next weekday if the 15th falls on a weekend.

Sergii24
Super User
Super User

Hi @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:

  1. Indetify the day of the week (remember, Power Automate deals with dates in UTC time zone only!)
  2. 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! )
  3. then send ppt 🙂

Good luck with your flow 🙂

@Sergii24  - Can you please provide detailed steps on how to achieve this as I am quite new to Power Automate.

@Relay9  has provided you a step-by-step guide 🙂

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.