cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Beat
Advocate IV
Advocate IV

Expression to get the date of Friday of the previous week

This expression works

addDays(utcNow(), dayOfWeek(utcNow()), 'dd-MMM-yyyy')
and adds, 1, 2, 3 etc. days in function of the current weekday.
How can I turn dayOfWeek(utcNow() into  - dayOfWeek(utcNow) -2
so that e.g. on a Monday it substracts 3 and on Tuesday it substracts 4 days to give me last Friday's date?
I expected something like 
addDays(utcNow(),-dayOfWeek(utcNow())-2, 'dd-MMM-yyyy')
would work but apparently I'm missing a point or two. 
Some help is greatly appreciated.
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
DamoBird365
Community Champion
Community Champion

@Beat 

 

You want to use the sub expression.

 

addDays(utcNow(), sub(-2,dayOfWeek(utcNow())), 'dd-MMM-yyyy')
 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

2 REPLIES 2
DamoBird365
Community Champion
Community Champion

@Beat 

 

You want to use the sub expression.

 

addDays(utcNow(), sub(-2,dayOfWeek(utcNow())), 'dd-MMM-yyyy')
 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

View solution in original post

Indeed, sub() was what I was looking for. Thank you so much for the prompt response! 

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (31,105)