cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
robhel Regular Visitor
Regular Visitor

Year Month Calculation on TODAY ()

Hello Guru's

 

Looking for your expert advice on how to achieve the following scenario of calculating the number of Year’s & Months from TODAY() until next lot of Long Service Leave (LSL) will be available.

 

There are 2 parts to this scenario:

 

LSL is available after 10years from commencement date

Additional 9days LSL for every year after 10yrs based on commencement date

 

I’ve came up with an extremely hack work-around for both steps above, which is still not providing me with required results:

 

Step 1)

From my table “CurrentEmployee”, I’ve split [Commencement Date] to DDMM and then included 2019 to it

 

I created a second table for employee’s that are under 10years, adding [Year] + 10 to commencement date

 

Then merged the 2 fields together providing existing LSL & upcoming LSL

 

 

Step 2)

 

I applied a new column with the following:

 

DaysLSL =

 

VAR Months = DATEDIFF(TODAY(),[MergedField],MONTH)

VAR Years = ROUNDDOWN(Months/12,0)

RETURN CONCATENATE(CONCATENATE(Years, “.”),Months-(Years*12)))

 

Which gives me the desired result, unless the date is prior to TODAY (re YMResult)

 

Greatly appreciate any assistance on a way to get desired result

 

EmpIDEmpNameCommDateMergedFieldYMResultYMDesiredResult
123Rod15/10/200715/10/20190.60.6
124Jim2/08/19992/08/20190.40.4
125Barney5/02/20145/02/20244.104.10
126Carl18/02/201918/02/20299.109.10
127Hannah1/03/20081/03/20190.-1.11
128Mary9/12/19999/12/20190.80.8
129Wayne27/06/198327/06/20190.20.2
130Kelly8/01/19858/01/20190.-3.9
131Kirsty1/02/19831/02/20190.-2.10
132Emma4/03/20134/03/20233.113.11
133Lou18/10/199918/10/20190.60.6
134Sarah16/01/200616/01/20190.-3.9
135Mike22/09/200822/09/20190.50.5
136Fred15/04/199915/04/20190.00.0
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Year Month Calculation on TODAY ()

@robhel ,

 

Try to change it as follows.

    CONCATENATE (
        CONCATENATE ( Years, "." ),
        MOD ( Months - ( Years * 12 ) + 12, 12 )
    )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Year Month Calculation on TODAY ()

Hi,

Please explain how the answer is 0.6, 0.4, 4.10, 9.10 etc?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
robhel Regular Visitor
Regular Visitor

Re: Year Month Calculation on TODAY ()

Thanks for response & in answer to your question, the result is based on TODAY less Commncement MMYY = number of months or years until next allocation of LSL, example

 

TODAY 27/04/2019 - 12/01/2022 Commencement Date (= 12/01/2012 + 10y) = 2years & 9Mths until LSL

TODAY 27/04/2019 - 29/10/2019 Commencement DDMM & Current Year (29/10/1979 to 29/10/2019) = .6 mths until next LSL days

 

Hope this answer your question

Community Support Team
Community Support Team

Re: Year Month Calculation on TODAY ()

@robhel ,

 

Try to change it as follows.

    CONCATENATE (
        CONCATENATE ( Years, "." ),
        MOD ( Months - ( Years * 12 ) + 12, 12 )
    )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)