Forum Discussion
How to create a column for a customize month
Hi, how to create a Month column if the date is N-10 days prior current month and N-10 days prior next month.
For example:
| Month | Start Date (N-10 days prior current month) | End Date (N-10 days prior next month) |
| July | 21st June | 21st July |
| August | 22nd July | 21st August |
| September | 22nd August | 20th September |
Please try this column expression instead.
MonthColumn =
VAR thisdate = 'Date'[Date]
VAR daysfromend =
INT ( EOMONTH ( thisdate, 0 ) - thisdate )
VAR monthtoformat =
IF ( daysfromend <= 10, EOMONTH ( thisdate, 1 ), thisdate )
RETURN
FORMAT ( monthtoformat, "yyyy-mm" )Pat
6 Replies
- amitchandak
Super User
Anonymous , If you have date
Then
Start Date = eomonth([Date],0) -10
End Date = eomonth([Date],1) -10
If you have month name create a date fist like
Date = "01-" & [Month] & "-" & [Year] // you can change data type to date
- AnonymousNot applicable
Hi amitchandak , based on the start and end date, how to create the month column?
I have date field in my table.
Month Start Date
(N-10 days prior current month)
End Date
(N-10 days prior next month)
2021-07 21-6-2021 21-7-2021 2021-08 22-7-2021 21-8- 2021 2021-09 22-8-2021 20-9-2021 - mahoneypat
Microsoft Employee
You can create a DAX column with an expression like this. Replace Table with your actual table name.
MonthColumn = FORMAT(Table[End Date], "yyyy-mm")Pat