Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

If Statement on formula based on negative or positive date value

(0) ShareShare
ReportReport
Posted on by 909 Super User 2024 Season 1

Hi,

 

Here is an example - Lets say DaraCardValue1 is 10/2/2023  and Today is 09/11/2023. 

 

DataCardValue1.SelectedDate - Today  = 10

 

What if DataCardValue1 is 09/09/2023 

 

DataCardValue1.SelectedDate - Today  = -2 

 

How can I based an if statment based on - / + result?

 

ie: If  DataCardValue1.SelectedDate - Today  = Positive Value then  "10 days till conclusion"  Or 

If  DataCardValue1.SelectedDate - Today  = Negative then "2 days overdue"

 

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on at
    Re: If Statement on formula based on negative or positive date value

    Hi @wonka1234 

     

    The DateDiff function returns the difference between two date/time values. The result is a whole number of units.

     

    If(
     DateDiff(Today(), DateValue(DataCardValue1.SelectedDate)) > 0,
     DateDiff(Today(), DateValue(DataCardValue1.SelectedDate)) & " days till conclusion",
     DateDiff(Today(), DateValue(DataCardValue1.SelectedDate)) < 0,
     DateDiff(Today(), DateValue(DataCardValue1.SelectedDate)) & " days overdue"
    )

     

     


    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

     

  • Verified answer
    TuxedoMask Profile Picture
    21 on at
    Re: If Statement on formula based on negative or positive date value

    Try This:

     

    If (DataCardValue1.SelectedDate - Today  > 0,  DataCardValue1.SelectedDate - Today() &" days till conclusion",DataCardValue1.SelectedDate - Today() & " days overdue");

     

     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard