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 Apps
Unanswered

Date Differences

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1

I'm aware there are lots of posts on this topic, just can't seem to find the right one to suit my query ! 🙂

 

I'm looking to find the number of business/week days between two dates.  One date is in a datepicker field and the other one is a text field which is being dynamically converted to a date field in the forumula.  It's working fine for me to get the number of days using:

 

"Days Open: " & DateDiff(DateValue(DCVCreated.Text),dateToday.SelectedDate,Days)

 

DCVCreated is a text field  and dateToday is a date field

 

That's fine returns the actual number of days between those two dates, However I only want the week days counted and have been trying to figure that out using the info here

 

https://powerapps.microsoft.com/es-es/blog/excluding-weekends-and-holidays-in-date-differences-in-powerapps/

 

but I just can't seem to get the syntex right..

 

Any ideas?

 

many thanks

Categories:
  • mdevaney Profile Picture
    29,993 Moderator on at

    @vffdd 

    Please give an actual example of dates that you tried and share what the result from the calculation was.  Share your full code.  It would also be helpful to see a screenshot of the app.

     

    In general, I have found the formula you referenced to be successful.  So that's why I am asking for more information.

    https://powerapps.microsoft.com/es-es/blog/excluding-weekends-and-holidays-in-date-differences-in-po...

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    So the formula as per the linked article  works as far as below 1., so that gives me an answer but it's not ideal because won't work for any dates that are less than a week ago.

     

    1.

    "Week Days Open: " & RoundDown(DateDiff(DateValue(DCVCreated.Text),dateToday.SelectedDate,Days) / 7, 0) *5

     

    However If I try to do the full forumula

    "Week Days Open: " & RoundDown(DateDiff(DateValue(DCVCreated.Text),dateToday.SelectedDate,Days) / 7, 0) *5+
    Mod(5 + Weekday(dateToda.SelectedDate) - Weekday(DateValue(DCVCreated.Text), 5)

     

    It says the Weekday function as invalid arguments.   I know it must be just something simple I'm missing or have done wrong in the syntax? but I have copied it exactly as per the article and as I said it works if I remove the last part of it..

     

     

  • mdevaney Profile Picture
    29,993 Moderator on at

    @vffdd 

    Can you supply a screenshot of which WEEKDAY function is being highlighted red in the formula bar (there are 2 in your formula).

     

    Also, can you show a screenshot of a value entered into DCVCreated?

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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 350 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 318

#3
Mohsin Ali Profile Picture

Mohsin Ali 220

Last 30 days Overall leaderboard