Forum Discussion

MCacc's avatar
MCacc
Helper IV
2 years ago
Solved

Build calendar using year

Hello, I'm trying to build a calendar where the min date starts 20 years ago from this year, and max date is 5 years ago from this year.   So because I'm 2024:    The first date is:  01/01/2004 ...
  • bhanu_gautam's avatar
    bhanu_gautam
    2 years ago

    MCacc 

     

    CalendarTable =
    VAR MinDate = DATE(YEAR(TODAY()) - 20, 1, 1)
    VAR MaxDate = DATE(YEAR(TODAY()) - 5, 12, 31)
    RETURN
    ADDCOLUMNS (
    CALENDAR (MinDate, MaxDate),
    "Year", YEAR([Date]),
    "Month", MONTH([Date]),
    "Day", DAY([Date]),
    "MonthName", FORMAT([Date], "MMMM"),
    "Quarter", "Q" & FORMAT([Date], "Q")
    )