Forum Discussion

_Aleksa_'s avatar
_Aleksa_
Helper II
6 years ago
Solved

Dynamic SWITCH TIME Statement

Hello,   I need help making the second part of the statement below dynamic so that it reflects current year appropriately as time goes by.   Tiers = SWITCH (     TRUE (),     'Weekly Data'[I...
  • v-gizhi-msft's avatar
    v-gizhi-msft
    6 years ago

    Hi,

     

    Please try this calculated column:

    Tiers = 
    IF (
        YEAR ( 'Table'[Date] )
            = YEAR ( TODAY () - 3 ),
        "CY",
        "PY"
            & DATEDIFF ( 'Table'[Date], TODAY () - 3, YEAR )
    )

    The result shows:

    See my attached pbix file.

     

    Best Regards,

    Giotto