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 Apps / How to subtract Weeks ...
Power Apps
Unanswered

How to subtract Weeks from a Date in PowerApps?

(0) ShareShare
ReportReport
Posted on by 555

Hi:

I have a Form with SharePoint List titled TASKS as my Data source.

The Fields are Due Date and Reminder Period in Weeks.

GOAL: While one keys in Reminder Period and then selects a Due Date, it should give an error message if the Reminder Date is less than Today.

Where, Reminder Date = Due Date - Reminder Period in Weeks.

QUESTION: How do I calculate the Reminder Date and save it in a variable varReminderDate

I can place a Label stating that "Please please select different value for either Reminder Period or the Due Date to make the Reminder Date in future." And, make this label visible only if varReminderDate < Today().

Note: I was able to do this using Power Automate easily but it takes a couple of minutes to run, save in SP List and messages the user after the fact. Thus, I would want to do the calculations in PowerApps itself to provide instant message before its submission if selected values are incorrect. See Attached scrrenshot.

Any help is appreciated.

Thank you,

Categories:
I have the same question (0)
  • Verified answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @SueA ,

     

    For this you can use the DateAdd function:

     

    DateAdd( <DueDate>, -7*<ReminderPeriod>)

     

    <DueDate> should ber repalced with a reference to the due date (DataCardValueX.SelectedDate) and <ReminderPeriod> should be replaced with a reference to the Reminder period (Value(DataCardValueY.Text)).

  • SueA Profile Picture
    555 on at

    Thank you!

    This worked.

    My formula: 

    DateAdd(DataCardValue37.SelectedDate,-7*(DataCardValue49.Text),TimeUnit.Days)

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @SueA ,

     

    Indeed that's it, although the TimeUnit argument is optional and, if not given, defaults to TimeUnit.Days. This is why I didn't included it in my earlier post.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard