cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

need help. How to count all days per request on my vacation apps powerapps?

i building a vacation apps using the leave request template availble from powerapps 
im using global variable, i need to get the sum of days per leave request by user.

 

if you could provide it will be appreciate.

 

thanks,

 

liam

8 REPLIES 8
Highlighted
Advocate I
Advocate I

Re: need help. How to count all days per request on my vacation apps powerapps?

I see the solution will require 2 parts:

 

1 - For each record in the LeaveCollection you will have to add a field that calculates the number of work days between StartDate and EndDate. I found this article that may help with this DateDiff calculation. https://powerapps.microsoft.com/de-de/blog/excluding-weekends-and-holidays-in-date-differences-in-po...

 

2 - Then you need to create a calculated field to a form that adds all the results for each Employee from the calculation  in Step 1 above. 

Highlighted
Community Support
Community Support

Re: need help. How to count all days per request on my vacation apps powerapps?

Hi @liam34 ,

Could you please share a bit more about your scenario?

Do you want to count the all days per leave request by user within your app?

 

If all Leave Requests submitted from your app are stored in LeaveCollection or a Table, I think the ForAll function could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

Add a Label within your app, set the Text property to following:

Sum(
    ForAll(
          LaeaveCollection,    // If you store the Leave request in other data source, please replace with the data source here
          DateDiff(StartDate, EndDate, Days)
    ),
    Value
)

Above formula would calculate the total days for all requests submitted from your app.

 

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: need help. How to count all days per request on my vacation apps powerapps?

hi kris thanks for the reply my scenario is im building a vacation/leave request using CDS variable, own entity and may use some of the global variable using custom enity.

my task is to is gettin the datediff or or how many days per request and get the total for all by the current user which will be in "Days" count or numeric.

hope this will clear a bit.

 

thanks 

 

Highlighted
Frequent Visitor

Re: need help. How to count all days per request on my vacation apps powerapps?

hi this seems a little bit tricky im just a newbie on powerapps can you provide more clearer instruction. thanks appreciate.

Highlighted
Frequent Visitor

Re: need help. How to count all days per request on my vacation apps powerapps?

im using my own cds and some global variable make field on it to connect on my cds.

Highlighted
Community Support
Community Support

Re: need help. How to count all days per request on my vacation apps powerapps?

Hi @liam34 ,

Could you please share a bit more about your scenario?

Do you use a CDS Entity as data source to store the Leave Request submitted from your app?

 

If you use CDS Entity to store your leave request records submitted from your app, please make sure the data structure of your CDS Entity is the same as that in the LeaveCollection (built-in collection to store the leave request record) as below:

1.JPG

 

I assume that your CDS Entity has same data structure as above, and you want to count request days per request based on current login user, please consider take a try with the following workaround:

Add a Data Table control in your app, set the Items property to following:

AddColumns(
           Filter('CDSEntity',Requester = User().Email),
           "TotalRequestDays",
           DateDiff(StartDate, EndDate, Days)
)

Then you could see the total request days for each leave request (submitted from your app) by current login user. The 'TotalRequestDays' column would store the toal Days value for each submiited leave request.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: need help. How to count all days per request on my vacation apps powerapps?

big thanks i got it i just need another thing, i just cant show the days per "request". i attached a pictures of the codes you sent me it works but now as exactly. and the screen im working on

 

now i need is how many days in a request so i can put on my vacation details.

realy appreciate 🙂

Highlighted
Regular Visitor

Re: need help. How to count all days per request on my vacation apps powerapps?

Sorry attempting to delete my reply without success

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,415)