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 / New column that calcul...
Power Apps
Unanswered

New column that calculates Vacation days earned based on Start date and years employed

(0) ShareShare
ReportReport
Posted on by 192

Looking for help to create a new column in my Dataverse table, that calculates the Accrued Days earned for vacation based on start date. This column would also need to be editable (rare but necessary). This will be used in my Vacation Time Off app to show how many days are alloted for the particular user.

 

Below are the guidelines that are needed for calculating the days (underlined in examples below)

After one full year of employment = earn 5 days of paid vacation.

After two full years of employment = earn 10 days of paid vacation.

After five years = earn 11 days

After six years = earn12 days

After seven years = earn 13 days

After eight years = earn 14 days

After nine years and higher = earn 15 days

 

Ex:

Michelle started on 11/16/2008 she would have accrued 15 days of vacation

Jane started on 11/25/2020 she would have accrued 10 days of vacation

Millie started on 1/1/2022 she would have accrued 5 days

Steve started on 2/15/2022 he would have accrued 0 days (would automatically change to 5 days on 2/15/2023)

 

My Table has the following columns already

EMP_EmployeeID   (ex: 18)

EMP_Name_LFM    (ex: Coslet, Michelle E)

EMP_DateOfHire    (ex: 11/16/2008 6:00 PM)

Status                     (ex: Active)

Employment Length (ex: 5161) = days employed

 

michellecoslet_0-1672844361658.png

 

Categories:
I have the same question (0)
  • Jcook Profile Picture
    7,783 Most Valuable Professional on at

    Hello @michellecoslet 

     

    1. Create new column example: "Accrued Days".

    2. Select Whole number as the type.

    3. Under the "Default Value" field, enter a formula to calculate the Accrued Days based on the start date. You can use the DATEDIF function to calculate the number of days between the start date and today's date. For example, the formula could be:

    =IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 9, 15,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 8, 14,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 7, 13,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 6, 12,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 5, 11,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 2, 10,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 1, 5, 0)))))))

     

    4. Save

  • michellecoslet Profile Picture
    192 on at

    EDITED TO ADD: I am only focusing on the Vacation Days type. Sick, bereavement, Jury duty may not be necessary.

     

     

    Looks like this should work.

    1. I setup the new column in my dataverse table (no where to write the default value however)

    2. In my app, I am not able to refer to this dataverse table even though i added the table.

     

    Here is my CURRENT formula used to show "days available out of Accrued days" that was setup with a list. I need to change it to reference the dataverse table column "Accrued Days" instead

     

    ThisItem.'TimeOffType: AllottedTime'.Value-ThisItem.RequestedTimeOff &"/"&Value(ThisItem.'TimeOffType: AllottedTime'.Value)

     

    Any tips?

     

    My Dataverse table name is titled "EmployeeWithFullName"

    Column name is "Accrued Days"

     

    michellecoslet_0-1673280684244.pngmichellecoslet_1-1673280703742.png

     

  • michellecoslet Profile Picture
    192 on at

    ERROR on the column formula

    I am not able to choose Number > whole number because there is no Default Value field

     

    I instead am trying Formula type and get 6 errors on the formula:

    michellecoslet_0-1673388689288.png

    1. Unexpected characters. Characters are used in the formula in an unexpected way.
    2. Expected operator. We expect an operator such as +, *, or & at this point in the formula.
      3. Expected operator. We expect an operator such as +, *, or & at this point in the formula.
      4.'DATEDIF' is an unknown or unsupported function.
      5.Unexpected characters. The formula contains 'ParenClose' where 'Comma' is expected.
  • michellecoslet Profile Picture
    192 on at
    =IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 9, 15,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 8, 14,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 7, 13,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 6, 12,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 5, 11,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 2, 10,
     IF(DATEDIF([EMP_DateOfHire], Today(), "Y") >= 1, 5, 0)))))))

    What does the "Y" represent? I still have not been able to get this formula to work unfortunately.

    Any help appreciated!

     

    thanks

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

#2
11manish Profile Picture

11manish 224

#3
Valantis Profile Picture

Valantis 181

Last 30 days Overall leaderboard