Forum Discussion

DmitryAD7's avatar
DmitryAD7
Icon for Helper I rankHelper I
2 years ago
Solved

Custom Date Period

Hello community,   Please help, I need to create a table with custom periods: Last 15 Months Previous 15 Months Years   I create all I needed in the calendar table:   Calendar = ADDC...
  • xifeng_L's avatar
    2 years ago

    Hi DmitryAD7 

     

    Is this the result you want?

     

     

    If yes, you can use the below code:

     

    Custom Periods = 
    UNION (
        ADDCOLUMNS (
            FILTER('Calendar','Calendar'[Last 15 Months]<>BLANK()),
            "Custom Period", 'Calendar'[Last 15 Months],
            "Sort", 1
        ),
        ADDCOLUMNS (
            FILTER('Calendar','Calendar'[Previous 15 Months]<>BLANK()),
            "Custom Period", 'Calendar'[Previous 15 Months],
            "Sort", 2
        ),
        ADDCOLUMNS ( 'Calendar', "Custom Period", 'Calendar'[Year], "Sort", 3 )
    )