cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Beat
Continued Contributor
Continued Contributor

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
Microsoft
Microsoft

@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
Microsoft
Microsoft

@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 😉

Beat
Continued Contributor
Continued Contributor

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

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,771)