cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
liam34
Level: Powered On

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
365-Assist
Level: Powered On

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. 

Community Support Team
Community Support Team

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.
liam34
Level: Powered On

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 

 

liam34
Level: Powered On

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.

liam34
Level: Powered On

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.

Community Support Team
Community Support Team

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.
liam34
Level: Powered On

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 🙂

dkkendal
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,296)