Forum Discussion
dannytan1112
3 years agoHelper I
Last Month
Hi,
I want to make a column that will return last month of the last year data as "last month"
| Date | New Column | |
| 2022/10/20 | October | |
| 2022/10/21 | October | |
| 2022/11/20 | November | |
| 2022/11/21 | November | |
| 2022/12/20 | December | |
| 2022/12/21 | December | |
| 2023/1/20 | Last Month | |
| 2023/1/21 | Last Month | |
My code is
New Column =
IF (
MONTH([Date]) < MAX ('table[Date]'),
FORMAT([Date],"MMMM"),
IF(MONTH([Date]) = MONTH(MAX('table'[Date])),"Last Month", BLANK())
)
Thanks
1 Reply
- amitchandakSuper User
dannytan1112 , you need column like
Month Type = Switch( True(),
eomonth([Date],0) = eomonth(Today(),-1*month(Today())),"Last year Last Month" ,
eomonth([Date],0) = eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0)= eomonth(Today(),0),"This Month" ,
Format([Date],"MMM-YYYY")
)