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 / Date Calculation and P...
Power Apps
Answered

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
    Microsoft Employee 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

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 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard