Forum Discussion
Subtract one month from date column
Hi Community,
I need to create a calculated column that subtracts one month from an Invoice date column.
The formula needs to be valid also for the change of the year.
[DATEADD works but only for a couple of rows..not sure why]
Can someone help me out here?
Thanks in advance
Hi alevandenes
Try using EDATE function (DAX)
Column = EDATE([Date],-1)Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
7 Replies
- v-jingzhang
Community Support
Hi alevandenes
Try using EDATE function (DAX)
Column = EDATE([Date],-1)Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. - KNP
Super User
DATEADD is the correct function to use.
Please provide some sample data, pasted as data.
Please explain what happens for the rows it is not working for.
- vaibhavkale570
Resolver III
Have you tried PREVIOUSEMONTH dax function?
- alevandenes
Helper IV
apparently it doesnt work with a table, but only with a single value specified
- AnonymousNot applicable
Take a month from a date column like this:
var Month_Name = Month(Datecolumn_name)
return Month_name-1
ORYou can also use Previous Month Function
- alevandenes
Helper IV
This doesnt work as it is only taking the month number minuts one.
it doesnt account for change of the year
thanks anyways
- CLQ
Helper I
I don't quite understand, you can use the function: Month('ColumnName')
or, if you want year and month number, something like:
concatenate(year(ColumnName),
month(ColumnName)).(and in the event that you always want a leading zero, an if >0 and another concatenate would be nice)
I don't know if it's what you were looking for. If you can give an example, better 😁