Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
Im trying to add dates in a calculated column to a date. For example, I have date 1.5.2021 in Column A and 24 months in column B. I want the result to be 1.5.2023 in column C. However, for some reason DATEADD doesnt seem to work and DATE(year(),month(),day()) doesn't work when the value of months reaches above 12.
Any ideas?
Solved! Go to Solution.
This can be quite tricky as the dateadd function requires a column reference and that column needs to have the date that would be the result of your addition. The simplest way to do this is to use the EDATE function so some thing like
NewDate = EDATE([Column A],[Column B])
# EDATE only works for months but that works fine in your case.
For me, I was trying to add 1 to the month inside my Date table definition - so - the fact that DateADD requires a column was annoying, and I couldn't reference the table I was trying to build. My solution was to use the EOMONTH function (EOMONTH - DAX Guide).
(note - this reply was edited - my former answer didn't take into account December to January transition)
"YY-MMM Or Current"
,IF( TODAY() >= DATE( YEAR([Date]), MONTH([Date]), 1) && TODAY() <= EOMONTH([Date],0)
, "Current Month"
, FORMAT(DATE(YEAR([Date]),MONTH([Date]) ,1),"YYYY-MMM")
)
Apart from the DAX EDATE([Column A],[Column B]) solution, if possible, you can also add a custom column in Power Query Editor.
= Date.AddMonths([Date],[Months])
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
This can be quite tricky as the dateadd function requires a column reference and that column needs to have the date that would be the result of your addition. The simplest way to do this is to use the EDATE function so some thing like
NewDate = EDATE([Column A],[Column B])
# EDATE only works for months but that works fine in your case.
Hey @CarlsBerg999 ,
it should work with DATEADD. Try it like this as a calculated column:
MyNewDate = DATEADD('Date'[Date], 24, MONTH)
Hi,
For some reason the calculated column returns blank when i do this. The date column is formatted as Date but for some reason refuses to accept any additions in months. I tried adding 2 months but it only worked for one row out of 250. Adding 3 months worked for 2 rows..
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
123 | |
79 | |
49 | |
38 | |
37 |
User | Count |
---|---|
196 | |
80 | |
70 | |
51 | |
42 |