Forum Discussion

pierre415's avatar
pierre415
Icon for Helper I rankHelper I
9 years ago
Solved

Create a List of Years

I need a list of the past 5 years in a new table, so the column would have (2013 ... 2016, 2017). List.Dates seems like the perfect function for this except the duration functions that it requires on...
  • v-ljerr-msft's avatar
    v-ljerr-msft
    9 years ago

    Hi pierre415,

     

    Based on my test, you should also be able to use the formula(DAX) below to create a new calculate table to make an automated list of past 5 years that updates itself over the years. :smileyhappy:

    Year = 
    DISTINCT (
        SELECTCOLUMNS (
            CALENDAR ( DATE ( YEAR ( TODAY () ) - 4, 1, 1 ), TODAY () ),
            "Year", YEAR ( [Date] )
        )
    )
    

     

    Regards