Date and string

Hello,

I am looking to get this as an output - Q4-xyz-F23

  • where Q4 is the previous quarter from the current quarter
  • xyz remains constant
  • F23 is the current fiscal year (starting from April of current calendar year - March of next calendar year)
  • 4 quarters April to June, July - Sep, Oct - Dec, Jan - Mar

Can anyone help me to achieve this?

Thanks y’all

Can you share the expected output

@kaurM

Hi @kaurM

currentQuarter= If (DateTime.Now.Month >= 4, "Q1",
    If (DateTime.Now.Month >= 7, "Q2",
        If (DateTime.Now.Month >= 10, "Q3", "Q4")))

previousQuarter= If (currentQuarter = "Q1", "Q4",
    If (currentQuarter = "Q2", "Q1",
        If (currentQuarter = "Q3", "Q2", "Q3")))

fiscalYear= If (DateTime.Now.Month >= 4, DateTime.Now.Year, DateTime.Now.Year - 1)

Message Box=> "Output: " & previousQuarter & "-xyz-F" & (fiscalYear Mod 100).ToString("00")

Note: fiscalYear is of DataType System.Int32. currentQuarter and previousQuarter are of DataType System.String

Hope it helps!!

1 Like

Thank you for the quick solution :slight_smile:

1 Like

You’re welcome @kaurM

Happy Automation
Regards

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.