cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Steve0
Microsoft
Microsoft

Calculate previous period from current date

All- I am trying to take todays date and map it to a End Date Column in a table to see if its equal to or less than any of the end dates listed to determine the period I am in. I then want to take the current period and find out what the previous period was. I plan to use the pervious period returned to display a message "You are entering time for Period P1 (dec)."

I have  tired DateDiff also

 

Here is a visual of my table and example of how I want to test result before using them in a message.
AccrualPeriods.PNG

PeriodCalculation.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User III
Super User III

@Steve0 
Seems like you could use some code like this in the Text property of the label.

"You are entering time for Period " &
LookUp(
    Sort(YourTableName, 'End Date', Descending),
    'End Date' >= DateAdd(Today(), 1 , Months),
    'Period Name'
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

1 REPLY 1
mdevaney
Super User III
Super User III

@Steve0 
Seems like you could use some code like this in the Text property of the label.

"You are entering time for Period " &
LookUp(
    Sort(YourTableName, 'End Date', Descending),
    'End Date' >= DateAdd(Today(), 1 , Months),
    'Period Name'
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (15,102)