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 / Trouble with trying to...
Power Apps
Unanswered

Trouble with trying to get started on a specific app

(0) ShareShare
ReportReport
Posted on by 241

I am trying to build a date calculator where you select a date from a date picker and it returns results of what day of the week and what day it is based on duration.  i will screen shot what we currently have that i am trying to move into powerapps and lists to handle this as our developers that wrote the original one are no longer here.

Not sure if i can handle this all within power apps itself or if i need to use a list to store the durations and holidays.  It also needs to be business days only.

 

This is what the output should look like:

scottmcnitt_0-1669153261249.png

 

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @scottmcnitt 

     

    Please look at DATEDIFF, DATEADD, and TimeZoneOffset. These are very handy functions for what you need.

     

    Full documentation here:

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-dateadd-datediff

     

    Great examples from this site:

    https://www.matthewdevaney.com/all-power-apps-date-time-functions-with-examples/

    https://www.matthewdevaney.com/power-apps-calculate-business-days-excluding-weekends-holidays/

     

     

  • scottmcnitt Profile Picture
    241 on at

    im trying something like this to a label but im sure the syntax is way off:

    Text(DateAdd(DatePicker.SelectedDate, 7, Days),CountIf(Weekday(Value) in [2,3,4,5,6],ShortDate)

  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @scottmcnitt 

     

    Please provide details of the input and what you are trying to achieve. The TEXT function is used for formatting and currently your provided values that not match the required properties.

  • scottmcnitt Profile Picture
    241 on at

    I have a DatePicker called DatePicker.  TextLabel that im trying to get 1 week added to the selected date but only business days.  SO if today was selected then the output label would display 11/29

     

  • scottmcnitt Profile Picture
    241 on at

    So i was able to figure out the Business Days part but now i need to also check against a SP list called DateHolidays and im not sure where to add this into my formatting:

     

    DateAdd(
    Now(),
    Value(7 + 2 * If(
    (Weekday(
    Now(),
    StartOfWeek.Monday
    ) + Value(7) > 5),
    RoundDown(
    (Value(7) - (5-Weekday(
    Now(),
    StartOfWeek.Monday
    ))) / 5,
    0
    ) + 1
    )
    ))

  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @scottmcnitt 

     

    I did a leave app before and this is what I did. I compute separately the number and store them on a Label. This is so to prevent lag/delay. Then what I'll do on the Final Number of Leave dates is compute it as

    Final Work Leave Days = Value(Total_Days.Text) - Value(Weekends.Text) - Value(Holidays_Not_on_Weekend.Text)

     

    cha_cha_0-1669218936832.png

     

  • scottmcnitt Profile Picture
    241 on at

    What does your Holidays_Not_on_Weekend.Text label look like and your Weekends.Text label

  • cha_cha Profile Picture
    4,932 Moderator on at

    Sorry i only had that screenshot and don't have access to the code now.

     

    But what I can recall,

     

    Holidays_Not_on_Weekend.Text 

    *Get the Holidays within the date

    • date <= last_day_of_leave
    • date >=first_day_of_leave

    *Filter the result thru a ForAll to exclude weekends.

     

    For the Weekends:

    -same as yours, use the weekday function along with StartOfWeek.

     

     

  • scottmcnitt Profile Picture
    241 on at

    So what i have going on now (which isnt quite working yet) 

    I have a text label with:

    scottmcnitt_0-1669261477003.png

     

    And the colHolidays collection:

    scottmcnitt_1-1669261531586.png

    It is still not factoring in the holidays properly.  i have tried several different date formats on the collection to no avail.  What am i missing?

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard