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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
TonyR1869
New Member

Dateadd

Hi,

 

if this Column formula works "3 months date = DATEADD('JobOrder (2)'[Maximum Date].[Date],-3,MONTH)"  why wouldn't  this Column formula work  4 months date = DATEADD('JobOrder (2)'[Maximum Date].[Date],-4,MONTH)"?

 

thanks

 

Tony

1 ACCEPTED SOLUTION
v-yingjl
Community Support
Community Support

Hi @TonyR1869 ,

Dateadd() function returns a table that contains a column of dates, shifted either forward or backward in time by the specified number of intervals from the dates in the current context. Please note that:

If the dates in the current context do not form a contiguous interval, the function returns an error.

The result table includes only dates that exist in the dates column.

For example, the date column like this, when using dateadd(), it will just return the follwing result because there is no date about 2019 exist in the already existing tables so that these columns will return blank by this formula.

add2.png

If there is a date related 2019 context exists, it will return normal results by this formula:

add1.png

For more details about Dateadd() function, please refer the microsoft document: DATEADD 

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yingjl
Community Support
Community Support

Hi @TonyR1869 ,

Dateadd() function returns a table that contains a column of dates, shifted either forward or backward in time by the specified number of intervals from the dates in the current context. Please note that:

If the dates in the current context do not form a contiguous interval, the function returns an error.

The result table includes only dates that exist in the dates column.

For example, the date column like this, when using dateadd(), it will just return the follwing result because there is no date about 2019 exist in the already existing tables so that these columns will return blank by this formula.

add2.png

If there is a date related 2019 context exists, it will return normal results by this formula:

add1.png

For more details about Dateadd() function, please refer the microsoft document: DATEADD 

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@TonyR1869 

This basically moving your date 3 or 4 months back. In this case that is max date. If 3 is working for purpose 4 will also

thats what I thought as well, but the 4 months back returns blank!

Mariusz
Community Champion
Community Champion

Hi @TonyR1869 

 

Can you provide the error message or explain the issue and scenario?

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

It just returns blank??? I'm trying to move Max Date back 3 or 4 months

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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