Forum Discussion
dokat
4 years agoPost Prodigy
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 ...
- 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 ZhengIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-angzheng-msft
4 years agoCommunity Support
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.
dokat
4 years agoPost Prodigy
v-angzheng-msft It worked. Thanks