cancel
Showing results for
Did you mean:
Resolver I

Date calculating issue at end of year to next year transition

I've created an app that helps staff schedule meetings in reverse, starting from the major meeting counting back to the minor meetings that lead to the major meeting.

I found Tim Leung's blog very helpful with some tweaking for our needs. Lots of WITH statements though but it works.

http://powerappsguide.com/blog/post/get-nth-weekday-for-a-month

This has worked great all year until now when staff are starting to schedule items that start in December 2022 but have the final meeting in January 2023. The calculator is showing all dates in 2023.

The formula for the PPW date is

``````With({CouncilFirstMonth:Date(Year(CouncilDatePicker_1.SelectedDate),Month(CouncilDatePicker_1.SelectedDate),1),WholeWeek:7},
With({CouncilDayofWeek:Weekday(CouncilFirstMonth,StartOfWeek.Wednesday)},
With({StudySFirstMonth:Date(Year(StudySessionDatePicker_1.SelectedDate),Month(StudySessionDatePicker_1.SelectedDate),1)},
With({DayofWeekStudyPrev:Weekday(StudyPrevMonth,StartOfWeek.Wednesday)},
If(StudySessionDatePicker_1.SelectedDate=SS2,PrevTuesSS,StudySessionDatePicker_1.SelectedDate=SS4, SS1,CouncilDatePicker_1.SelectedDate=Council1st,CouncilPrevTuesMonth,CouncilDatePicker_1.SelectedDate=Council3rd,Council1st,IsBlank(CouncilDatePicker_1),"")))))))))))))))``````

The formula for the 3P meeting date is (note the COW datepicker is actually the PPW date):

``````With(
{
PrevFirstOfMonth: Date(
Year(COWDatePicker_1.SelectedDate),
Month(
COWDatePicker_1.SelectedDate,
-1,
Months
)
),
1
),
WholeWeek: 7
},
With(
{
DayOfWeekPrevFirstOfMonth: Weekday(
PrevFirstOfMonth,
StartOfWeek.Tuesday
)
},
With(
{
PrevFirstOfMonth,
(1 * WholeWeek) - (DayOfWeekPrevFirstOfMonth)
)
},
With(
{
PrevFirstMonday,
WholeWeek * 2
),
PrevFirstMonday,
WholeWeek * 3
)
},
If(
IsBlank(CouncilDatePicker_1),
"",
PrevThirdMonday,
PrevFourthMonday
)
)
)
)
)``````

Any assistance is appreciated.

Thank you,

Linda

1 ACCEPTED SOLUTION

Accepted Solutions
Resolver I

I solved my own problem. I created a variable for the major meeting using in the OnSelect properties of the Major meeting date picker.

``Set(MajorMeeting, ISOWeekNum(Majormeetingdatepicker.selecteddate))``

Then in the second meeting date picker, I created another WITH statement (yes, more, I know...so many!!)

``````With({2ndPrevMonthYear: Date(Year(DateAdd(MajorMeetingDatePicker_2.SelectedDate,-1, Years)),Month(DateAdd(MajorMeetingDatePicker_2.SelectedDate, -1, Months)), 1)},
With({2ndDayOfWeekPrev: Weekday(2ndPrevMonthYear,StartOfWeek.Wednesday)},

Further down in the second meeting date picker, I included in my existing nested IF statement:

``MajorMeeting<8,2ndPrevTuesYear``

I chose the number 8 because by the 8th week of the new year, there will no longer be conflict with the date transition from the previous year. I tested the new formula a couple of years in advance and it works.

Now my only issue is that when I reset the date picker the date picker clears but has a default date of 1/1/1970. Ugh.

Resolver I

I solved my own problem. I created a variable for the major meeting using in the OnSelect properties of the Major meeting date picker.

``Set(MajorMeeting, ISOWeekNum(Majormeetingdatepicker.selecteddate))``

Then in the second meeting date picker, I created another WITH statement (yes, more, I know...so many!!)

``````With({2ndPrevMonthYear: Date(Year(DateAdd(MajorMeetingDatePicker_2.SelectedDate,-1, Years)),Month(DateAdd(MajorMeetingDatePicker_2.SelectedDate, -1, Months)), 1)},
With({2ndDayOfWeekPrev: Weekday(2ndPrevMonthYear,StartOfWeek.Wednesday)},

Further down in the second meeting date picker, I included in my existing nested IF statement:

``MajorMeeting<8,2ndPrevTuesYear``

I chose the number 8 because by the 8th week of the new year, there will no longer be conflict with the date transition from the previous year. I tested the new formula a couple of years in advance and it works.

Now my only issue is that when I reset the date picker the date picker clears but has a default date of 1/1/1970. Ugh.

Announcements

Power Platform Connections Ep 15 | L. Baybutt | Thursday, 1 June 2023

Episode Fifteen of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Lewis Baybutt aka Low Code Lewis, alongside the latest news and community blogs.   Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.      Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.

Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/

Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.       Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.    Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.

Welcome to the Power Apps Community

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