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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / DateAdd does not want ...
Power Apps
Answered

DateAdd does not want to add date in the patch function

(0) ShareShare
ReportReport
Posted on by 18

Hi every one, I really can do with some help here for i'm a bit lost,

 

My code below should count the days between the date pickers. After that it should patch new items in the sharepointlist for as many days counted in the sequence. The only thing is: It does not add 1 day to the variable "VarEersteZaterdag" every time it runs over the patch.  Below my code:

 

ForAll(
Sequence(
DateDiff(DatePicker1.SelectedDate;DatePicker2.SelectedDate));


Patch(MonteurPlanning;Defaults(MonteurPlanning);
{
Title: VarNieuweMonteur.Title;
XXFocusDatum: DateAdd(VarEersteZaterdag;Value(1);TimeUnit.Days)
}
)
)

 

Hope you can help me on my way. Thanks in advance

 

Kind regards Garjet

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,570 Most Valuable Professional on at

    Hi @Garjet1 ,

    I do not know what you are doing with the Variable, but if you want a record for each date between the Date Pickers (inclusive of their dates), you would do this

    ForAll(
     Sequence(
     DateDiff(
     DatePicker1.SelectedDate;
     DatePicker2.SelectedDate
     )
     ) + 1;
     Patch(
     MonteurPlanning;
     Defaults(MonteurPlanning);
     {
     Title: VarNieuweMonteur.Title;
     XXFocusDatum: 
     DateAdd(
     DatePicker1.SelectedDate;
     Value - 1;
     TimeUnit.Days
     )
     }
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Garjet1 Profile Picture
    18 on at

    Hi warren, Thanks for your reply. Very helpfull. 

    I Adjusted the code and it works fine now. 

    Lateron I struggled a bit with an interval of 7 days because de DateADD only wanted to do 1 day interval. I adjusted the "number of units" to:  Value * 7 and now it does a 7 days interval.

     

    Thanks again for you help.

     

    Kind regards

    Garjet

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard