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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Date Calculation and P...
Power Apps
Unanswered

Date Calculation and Print to PDF

(0) ShareShare
ReportReport
Posted on by 2

Good Afternoon Community,

 

I have a challenge. I am doing a employment experience calculator. Testing my abilities in PowerApps. In the calculator I am trying to calculate the years, months and days difference for multiple period. Now figuring out the DateDiff in years, months and days is between the start and end days is easy. I did that but here is the scenerio.

 

Lets say I have a total of 1700 days. That is 4 years, 7 months and 21 days which I am able to replicate in excel using the DatedIf function.  In PowerApps, I want that same result in txtTotalTimeElapsed which is highlighted below. I have tried taking the value of each periods DateDiff(input1,input2,Days) then divide it by 365 to get the years and by 30 days to get the months but the calculations are not adding up. I feel like a concat function would be the solution but I was wrong. Any help would be appreciated. 

 

ScreenShot.JPG

Side question, I am not using a form but I would like the user to be able to print the data as a PDF in a specific format.

 

Categories:
I have the same question (0)
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @DataGuy85,

    Try as below:

    With(
     {
     totalDays: DateDiff(
     DatePicker2.SelectedDate,//statrt date
     DatePicker3.SelectedDate,//end date
     Days
     ) + 1
     },
     With(
     {
     totalYears: RoundDown(
     totalDays / 365,
     0
     ),
     remainingDaysFromYearsRollUp: Mod(
     totalDays,
     365
     )
     },
     With(
     {
     MonthsInRemainingDays: RoundDown(
     remainingDaysFromYearsRollUp / 30,
     0
     ),
     remainingDaysFromMonthsRollUp: Mod(
     remainingDaysFromYearsRollUp,
     30
     )
     },
     totalYears & " years / " & MonthsInRemainingDays & " months / " & remainingDaysFromMonthsRollUp & " days"
     )
     )
    )

    vqiaqimsft_0-1651728874750.png

     

  • DataGuy85 Profile Picture
    2 on at

    Thank you that fixed it.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard