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

Calculate the useful day in a gallery item when it is selected

Hello

 

I'm starting out on PowerApps and I'm having the following problem:

 

I have a gallery where I need to calculate the date for each item.

 

For the first item is easy, I just need to inform the date today, but for the other items, I need to calculate the date based on the date of the last selected item by adding the deadline of the current item.

 

For example, in the image below, the date displayed for the items #1 and #2 are correct. The dates of the items #3 and #4 must be blank and the date of the item #5 must be the date of the item #2 (last item selected) plus 10 days (the deadline is in the "Deadline column").

 

Additionally, if the calculated date is a Saturday or Sunday, the date of next Monday should be displayed.

 

Items in this gallery will always be sorted in ascending order by the "Seq." column.

 

Is it possible to do that?

 

Many thanks!

 

GalleryDates.PNG

2 REPLIES 2
Super User
Super User

Re: Calculate the useful day in a gallery item when it is selected

What you are looking for is DateAdd. Here's the details: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff For example: to add 10 days to the current date you would use: DateAdd( Today(), 10, Days) Note: Days is the default so technically you could just say DateAdd(Today(), 10) Dealing with the weekends is a little more complex. There are several posts which deal with this subject that I would suggest you review. The two primary posts (which are related) are: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Auto-selecting-a-Date-that-doesn-t-... https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Date-Selection-No-Weekends-or-Holid...
Highlighted
pquateli
Level: Powered On

Re: Calculate the useful day in a gallery item when it is selected

Hello LRVinC,
 
Thanks for your answer. I will read the posts you recommended about working with weekends and holidays.
 
I know DateAdd function but I what I realy need is to add the number of days to a date that is in another gallery item.
 
Taking the image from the previous message as an example, my DateAdd to calculate the date in item # 5 should look like this:
 
DateAdd (Date_from_Item_#2 (because itens #3 and #4 are not selected); Deadline_from_Item_#5; Days).
 
I keep looking for a solution (if I was working in VBA I would know how to solve ...)
 
Tks!
 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,837)