Days in Month Calculation

Is there a function to calculate how many days are in the current month. Reason: I have staff that are being hired throughout the month. I have their hire date and would like to know how may days of eligibility they have each month to work. So if im hired on 3/15/24, I would have 16 days to the 31st to have productive work.

It’s not elegant, but this works.

days left in month.transform (4.9 KB)

I include the current day as available to work. You might want to subtract 1.

It might be a good idea to add DaysInMonth and (to account for leap years) DaysInYear to Calculate. I will give it some thought.

1 Like

Hi @patrick

Here is my take on it.

Transform file.
EligibleWorkDays.transform (1.8 KB)

1 Like

I have a 100 year calendar which I keep using for doing all sort of lookups, I have shamelessly included @Anonymous solution.

I have attached 1 year of it , since the file is 5 MB and I cannot archive and post here

DateMaster with Remaining.csv (58.0 KB)

1 Like

@Anonymous More elegant than my solution. As usual. ;0)

@prashant I had a look at your lookup table and I think you can fairly trivially do the majority of those already using Calculate and DateTime format:

date-calculations.transform (9.7 KB)

DaysInMonth and DaysInYear in year would help to complete things. Things like fiscal year are probably too obscure to include and may vary between organizations.

Andy !! this 100 year calendar was purely made in EDT only . I use it for variety of lookups in financial calculations. Fiscal Year is for Indian Financial year.

But this is a fine example of what EDT can do , I started by doing two dates , 100 year apart , used sequence to generate dates :smiley:

1 Like

Amazing as always forum!!

1 Like

It is a good idea to generate a lookup table like this for things you use a lot, that might take several transforms to create from scratch.

if the FY doesn’t match the calendar your, I would build is with calculations, too…

E.g.
if FY is Oct to Sept, you can calculate
if Month is ≥ 10 → (Month - 10)
if Month <10 → (Month + 3)
if Month is ≥ 10 → Year + 1 (which represents the FY)

This combined with the suggestion it should do the job. the calculation can be done in 2 if transformations one for month (using if with elseif)and one for the year.

2 Likes

These are now coded and tested and will be in v2.

On behalf of 1.4 BILLION Indians, I request for Fiscal Quarter , Fiscal years native calculations too

If all 1.4 BILLION of them buy Easy Data Transform, then we promise to add it.

2 Likes

I request for Fiscal Quarter , Fiscal years native calculations too

In my business life I have worked for companies with FY:

  • Jan-Dec (calendar year)
  • April - March
  • July - June
  • Oct - Sept

All in the same country, as it is allowed in some countries to define the frame by yourself.

I think there is no general world wide is not possible. The rules are quite simple.

I think if own rules are implemented, it would be good to have a functionality to store such blocks of transformations as an own function in a form of library to be re-used. (something like this was discussed formerly, already)

2 Likes