Add Financial Year to String

Hey team,

Can someone please assist me to add the Financial Year to a Date String?
I need it to look at a date entered and return the financial year it falls into:
image
Of it helps, it will be added to a MoveFile process and to future proof the process, it would be great to have this in place.

Thanks in advance!

Hey @Stephen_B,

Welcome back !!.

do you want to add FY2020 to your datetime string ?Can you give me some more detail what are you trying to achieve.

Hello @amarasto,

Thanks for your help again.
I will be downloading reports each month and filing away into a folder for each month.
So for June, the path would be FY 2019\Jun 19[file name].
For July, it would be FY 2020\Jul 20[file name].

I have the rest sorted, but I cannot do the FY part.

There is another part where I need to add the first month of the FY, but can work that out once I have the logic for FY dates.

The red square is what I need to change due to the FY based on the previous month, and the blue is what I have used to return the month of the report:
image

Hope that helps to explain what I need!

Hey @Stephen_B,

Create a variable named as VAR_FY and assign it to following:

Var_FY=“FY”+datetime.Now.ToString(“yyyy”)

and then use Var_FY in place of red square and you are good to go.

Thank you @amarasto,

I think I have done something incorrect.
Here is my variable:
image

Destination in the MoveFile is:
"\xxx\yyy" + “Var_FY” + "" + datetime.now.AddDays(-15).ToString(“yyyy.MM”) + "\Handbook - " + datetime.now.AddDays(-15).ToString(“MMM yy”) + “.csv”

My file path I am trying to achieve is:
\xxx\yyy\FY 2019\2019.06 and then name it “Handbook - Jun 19”.

Next month it would be \xxx\yyy\FY 2020\2019.07.

Thanks again!

Thanks,
Stephen

Hey @Stephen_B,

use Var_FY without “” as mentioned below:

“\xxx\yyy” + Var_FY + “” + datetime.now.AddDays(-15).ToString(“yyyy.MM”) + "\Handbook - " + datetime.now.AddDays(-15).ToString(“MMM yy”) + “.csv”

Thanks @amarasto,

I was able to get it to work and to save where I wanted it.
Can I please confirm though that this is returning the year now (ie 2019):
“FY ”+datetime.Now.ToString(“yyyy”)

For the July reports (available in August), I would like it to return FY 2020, and in January it will need to also return FY 2020.

Thanks,
Stephen

I need to understand the logic here for calculating FY.How do you calculate the FY?

The condition we implemented it will give you FY2019 until the transition to the next year.

If you can give me the logic to calculate the FY i can modify the condition accordingly.

It will return the current year only.

You mean need to add upcoming financial year ???

Thanks to you both.

July 18 - Jun 19 is FY2019.
July 19 - Jun 20 is FY2020.
July 20 - Jun 21 is FY2021.

And so on.

Thanks.

Hi @Stephen_B,

Try below code
"FY "+(Now.Year+if(Now.Month>6,1,0)). ToString()

Regards,
Arivu

3 Likes

“FY”+datetime.Now.ToString(“yyyy”)

@arivu96 is right. Make sure you calculate the financial year. You will need to do that in another workflow where you send as an argument the current date, and it returns back the period, week, and year.

Typically, a financial year is 13 periods with 4 weeks each and equals 364 days. Then, it will depend on when your year starts. Some companies always start on July 1st. Others (like in the USA) will start on the first Sunday before January 1st. So determine the first day of the current financial year, then you can figure out the last day of that year by adding 364 days, and thus knowing which year the current date lands in.

My head hurts thinking about it though. Maybe someone can help with a calculation. Essentially, if you have Dec 30, 2019 or Jan 1, 2020, you should get back a year of 2020, since the first day for 2020 would be July 1st 2019.

Good luck!

Hey @Stephen_B,

Use This:

If(Convert.ToInt32(DateTime.Now.Month.ToString(“MM”))>6)

Var_FY=“FY”+DateTime.Now.AddYears(1).ToString(“yyyy”)

else
Var_FY=“FY”+DateTime.Now.ToString(“yyyy”)

Thanks @arivu96,

Here is what I have but I am getting an error:

“FY ”+datetime.Now.Year+IF(Now.Month>6,1,0).ToString(“yyyy”)

Don’t use “yyyy”

"FY "+(Now.Year+if(Now.Month>6,1,0)).ToString()

Thank you everyone.

This is working:
"FY "+(Now.Year+if(Now.Month>6,1,0)). ToString()
But it is returning FY 2020.

Apologies if this has been lost in the post, but I need to return the FY of last month.
So for July, I need to financial year of June.
In August, I will need the financial year of July.

I’ve managed to work it out that this is what I need:
"FY "+(Now.AddMonths(-1).Year+if(Now.AddMonths(-1).Month>6,1,0)). ToString()

I think that will work for ever month (December/January included).

Thanks everyone!