Skip to main content

Notifications

Community site session details

Community site session details

Session Id : BF4pqJ0Fa7LZSr/Iq71Wl9
Power Automate - Building Flows
Answered

Adddays function dynamic days value

Like (1) ShareShare
ReportReport
Posted on 7 Aug 2023 06:37:58 by 75

Hello,

 

I am having trouble adding a dynamic day value to the adddays funtion I keep getting the "Expression is invalid" error.

I would like to subtract days from today depending on an input from PowerApps.

 

This is my function for initialize a variable value,

 

addDays(utcNow(),-outputs('DaystoAdd'),'MM-dd-yyyy')
 
Any ideas on what I am doing wrong.
TIA
  • Verified answer
    ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 07 Aug 2023 at 06:51:36
    Re: Adddays function dynamic days value

    Hi @NicolleAbrahams 

     

    You need to multiple the DaystoAdd output with -1 to get the negative number which when added with addDays function gives you the past date.

     

    Pls use the below expression:

    addDays(utcNow(),mul(int(outputs('DaystoAdd')),-1),'MM-dd-yyyy')

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,089 Most Valuable Professional

Leaderboard
Loading started
Loading complete