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 / Calculating a DateDiff
Power Apps
Answered

Calculating a DateDiff

(0) ShareShare
ReportReport
Posted on by 220

Hi,

I'm currently trying to write the date that is 91 days from my end date (which is set in a variable).

My variable varPayPeriodSelectedDropdownEndDate = 3/31/2022

 

I have written this code to start but not sure how to get the return date...

DateValue(DateDiff(Today(), varPayPeriodSelectedDropdownEndDate)-91)

This gives me a value of 1/1/1990?

I would like to SET the datediff value in a variable as well to be used later.

 

Appreciate your support 🙂

 

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @TB05 

    Please consider changing your Formula to the following:

    DateAdd(Today(), varPayPeriodSelectedDropdownEndDate, -91)

     

    I hope this is helpful for you.

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

     

    DateDiff(Today(), DateAdd(varPayPeriodSelectedDropdownEndDate,-91,Days), Days)

     

    That should get you the diference. It will return an int (1, 2, 3, 4, etc)

     

    To set that in a var:

     

    Set(varDiference, DateDiff(Today(), DateAdd(varPayPeriodSelectedDropdownEndDate,-91,Days), Days))

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    Buy me a coffee!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • TB-20081424-0 Profile Picture
    220 on at

    Thank you for your quick response, the label field returns a blank entry:

    TB05_0-1648653572963.pngTB05_1-1648653591246.png

     

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @TB05 

    The formula is correct.  But for something else...my bad for not noticing.

    The formula should be:

    DateAdd(varPayPeriodSelectedDropdownEndDate, -91)

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard