web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calculate eligible dat...
Power Apps
Answered

Calculate eligible date based on field in SharePoint list every other year

(0) ShareShare
ReportReport
Posted on by 1,512

I have an app that does equipment reimbursement. People are eligible for new equipment every two years  I need to calculate when that next date will be.

 

Previous Purchase date: 01/01/2021

Next Eligible Date: 01/01/2023

 

I do not know how to do this?

 

Any help would be appreciated.

Categories:
I have the same question (0)
  • Cre-do Profile Picture
    30 on at

    Hello  Dorinda,

    have you checked DateAdd function in PowerApps?

  • Dorinda Profile Picture
    1,512 on at

    I have not and I am not even sure how to begin to calculate it so every other year??

  • Cre-do Profile Picture
    30 on at

    Well. In that particular case, you should use 

     

    Text( DateAdd( Today(), 2, Years ),

    "dd-mm-yyyy hh:mm" )

     

    Where:

    • Text function is used for formating data.
    • DateAdd function is used to add units (seconds, minutes, hours, days, months and years) to date/time.
    • Now() function displaying actual data & time.
    • "2" - because you want to add two
    • Years
    • "dd-mm-yyyy hh:mm" defines format of time and date value.
  • Dorinda Profile Picture
    1,512 on at

    This is great if I was calculating it based on Today, how do I reference a date field in my SharePoint list instead of Today()

  • Cre-do Profile Picture
    30 on at

    Use connector with SharePoint list.

    Then Filter data, or use LookUp function.

    Use filtered data same way you could use "today ()".

  • Dorinda Profile Picture
    1,512 on at

    @Cre-do Thank you for getting me part of the way there.  I have this sorta working

     

    Text( DateAdd(DateValue(Label15.Text), 2, Years ),
    "mm-dd-yyyy" )

     

     

    It is returning a date in the future however I need to put a condition in this equation.

     

    If Equipment type = Safety Toe Boot, then do that calculation, if it equals Safety Eye Protection do the same calculation.

     

    I have them in two different labels just cant seem to get the syntax correct.  I tried this with no luck

    If('Safety Equipment Reimbursement'.'Equipment Type'="Safety Toe Boot",Text( DateAdd(DateValue(Label15.Text), 2, Years ),
    "mm-dd-yyyy" )
  • Cre-do Profile Picture
    30 on at

    That's just half of your "IF" statement.

     

    If('Safety Equipment Reimbursement'.'Equipment Type'="Safety Toe Boot"||'Safety Equipment Reimbursement'.'Equipment Type'="Safety Eye Protection",Text( DateAdd(DateValue(Label15.Text), 2, Years ),

    "mm-dd-yyyy" ))

     

    || - means "or".

  • Dorinda Profile Picture
    1,512 on at

    I am getting this error now 

    Dorinda_0-1664289844880.png

     

  • Cre-do Profile Picture
    30 on at

    Yes, you can't compare different value types. As you can see, you've text value in your dateadd formula.

    You trying to compare text from your app, with table in your SharePoint. You will need some kind of filtering state.. Like Filter or LookUp. 

  • Dorinda Profile Picture
    1,512 on at

    @Cre-do 

     

    I guess my brain is not firing I am not getting this to work

    LookUp('Safety Equipment Reimbursement',EmployeeName.Email=CurrentUserEmail && 'Equipment Type'="Safety Toe Boot" && Text( DateAdd(DateValue(Label15.Text), 2, Years ),
    "mm-dd-yyyy" ))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard