cancel
Showing results for
Did you mean:
Resolver I

## Calculating a DateDiff

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

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

The formula should be:

``DateAdd(varPayPeriodSelectedDropdownEndDate, -91)``

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
4 REPLIES 4
Super User

``DateAdd(Today(), varPayPeriodSelectedDropdownEndDate, -91)``

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Super User

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

To set that in a var:

If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,

Gonçalo Nogueira

Check my User Group (pt-PT)!

Last Post on Community

My website!

Resolver I

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

Super User

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

The formula should be:

``DateAdd(varPayPeriodSelectedDropdownEndDate, -91)``

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Announcements

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

#### 2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

#### Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Top Kudoed Authors
Users online (3,724)