I would like to create Quarterly report (areachart) for 12 quarters from now.

I have starting quarter, ending quarter ,startyear and end year. Need to get the quarter names dynamically in x axsis.

For example,

01-10-2020 (4th quarter) to 08-09-2023(third quarter)

Xaxsis categoreis should be Qtr4,Qtr1 2021, Qtr2,Qtr3,Qtr4,Qtr1 2022,Qtr2,....Qtr3 2023

Please any suggestions.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    This requires the plugin "Date and Time Utilities".

    a!localVariables(
      local!start: todatetime(date(2020, 10, 1)),
      local!end: todatetime(date(2023, 9, 8)),
      local!quarters: a!forEach(
        items: enumerate(elapsedmonths(local!start, local!end)),
        expression: if(
          ceiling(month(edate(local!start, fv!item)) / 3) = month(edate(local!start, fv!item)) / 3,
          ceiling(month(edate(local!start, fv!item)) / 3),
          null
        )
      ),
      a!forEach(
        items: reject(isnull(_), local!quarters),
        expression: concat(
          "Qtr",
          fv!item,
          if(
            fv!item = 1,
            " " & year(edate(local!start, fv!index * 3)),
            ""
          )
        )
      )
    )

Reply
  • 0
    Certified Lead Developer

    This requires the plugin "Date and Time Utilities".

    a!localVariables(
      local!start: todatetime(date(2020, 10, 1)),
      local!end: todatetime(date(2023, 9, 8)),
      local!quarters: a!forEach(
        items: enumerate(elapsedmonths(local!start, local!end)),
        expression: if(
          ceiling(month(edate(local!start, fv!item)) / 3) = month(edate(local!start, fv!item)) / 3,
          ceiling(month(edate(local!start, fv!item)) / 3),
          null
        )
      ),
      a!forEach(
        items: reject(isnull(_), local!quarters),
        expression: concat(
          "Qtr",
          fv!item,
          if(
            fv!item = 1,
            " " & year(edate(local!start, fv!index * 3)),
            ""
          )
        )
      )
    )

Children