Forum Discussion

dokat's avatar
dokat
Post Prodigy
4 years ago
Solved

Add column with if condition

Hi,   I have a table (Tier) where i'd like to add column based on CY Column with Month End Dates. I am using below formula if date is 1/31/2021 add Jan, if 2/28/2021 add in February....and YTD add ...
  • v-angzheng-msft's avatar
    4 years ago

    Hi, dokat 

    Column =
    SWITCH(
        TRUE(),
        [CY] = dt"2018-12-31", "2018",
        [CY] = dt"2017-12-31", "2017",
        [CY] = dt"2019-12-31", "2019",
        [CY] = dt"2020-12-31", "2020",
        [CY] = dt"2021-12-31", "last year",
        [CY] = dt"2022-02-28", "last month"
    )
    

    Result:

    Hope this helps.

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.