Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rayinOz
Helper III
Helper III

Calculate Date based on existing Date column

Hello PowerBI users

 

I have a date column and I want to create a new column based on that date. The new date (in the new column) would be minus 25 months from the existing column.

 

Thoughts?

 

Kind regards

Ray

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @rayinOz ,

 

To use dateadd function, we should create a calendar table in advance and create relationship between tables.

 

calendar = CALENDAR(DATE(2016,01,01),DATE(2019,12,31))
Column = DATEADD('calendar'[Date],-25,MONTH)

To use EDATE as @Ashish_Mathur metioned, we can get the excepted result without calendar table.

pre = EDATE('Table'[date],-25)

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @rayinOz ,

 

To use dateadd function, we should create a calendar table in advance and create relationship between tables.

 

calendar = CALENDAR(DATE(2016,01,01),DATE(2019,12,31))
Column = DATEADD('calendar'[Date],-25,MONTH)

To use EDATE as @Ashish_Mathur metioned, we can get the excepted result without calendar table.

pre = EDATE('Table'[date],-25)

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

Try this calculated column formula

=EDATE(Data[Date],-25)

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

Dateadd should allow you to do that. Give interval negative

https://docs.microsoft.com/en-us/dax/dateadd-function-dax

jdbuchanan71
Super User
Super User

Hello @rayinOz 

Give this a try.

Column = DATE ( YEAR ( 'Date'[Date] ), MONTH ( 'Date'[Date] ) -25, DAY ( 'Date'[Date] ) )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.