web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Exclude weekends from ...
Power Automate
Answered

Exclude weekends from date field

(0) ShareShare
ReportReport
Posted on by 158

I wrote the below compose formulas to try and filter out weekends. The first two worked (compose 1 & 3) but Compose 2 failed. Hoping someone can help me write it. 

 

Compose - utcnow()

Compose 3 - dayOfWeek(formatDateTime(utcnow()))

Compose 2 - if( equals(dayOfWeek(formatDateTime(utcNow()),'4'),addDays(utcNow(),-3), addDays(utcNow(),-1)))

 

KhrystinaM_0-1705960025369.png

 

Categories:
I have the same question (0)
  • eliotcole Profile Picture
    4,363 Moderator on at

    Hi, @KhrystinaM, try this:

    if(
    	equals(
    		dayOfWeek(utcNow()), 
    		0
    	), 
    	addDays(
    		utcNow(), 
    		1
    	), 
    	if(
    		equals(
    			dayOfWeek(utcNow()), 
    			6
    		), 
    		addDays(
    			utcNow(), 
    			2
    		), 
    		utcNow()
    	)
    )

    That should add one day if today is Sunday, two if it is Saturday, and none for any other day.

  • Verified answer
    AbigailRausch Profile Picture
    48 on at

    @eliotcole 's solution looks perfect! But if you were also curious about why your current expression was failing, it looked like it 1) had the "4" in single quotes (which isn't needed due to comparing with an integer) as well as 2) the main culprit, parentheses slightly off. (That's why you got an error saying it expected more arguments than it got).

    I think the expression is probably more like this:

    if(equals(dayOfWeek(formatDateTime(utcNow())),4),addDays(utcNow(),-3), addDays(utcNow(),-1))
  • KhrystinaM Profile Picture
    158 on at

    I ended up using @AbigailRausch formula, but I appreciate both responses. Thank you for your help. 

    @eliotcole 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard