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
NatK
Frequent Visitor

DATEADD cannot add 14 days

Hi,

 

I created a custom column to add 14 days to a date (Document Date), but it is returning a blank value. If I change the number of days to 10 or under, it works perfectly. Is there a limitation to the number of days you can use with DATEADD? Or am I missing something?

 

Result with 14 days:

First Payment Due Date = DATEADD('Purchase Lines'[Document Date], 14, DAY)

 

officeops3_1-1670012629578.png
Result with 10 days:

First Payment Due Date = DATEADD('Purchase Lines'[Document Date], 10, DAY)

 

officeops3_0-1670012563985.png


Thanks!

 

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

Hi, @NatK ;

Because the date returned by dateadd is first the date in 'Purchase Lines' [Document Date], if the resulting date is not in this 'Purchase Lines' [Document Date] column, it returns empty. For example, 2022-11-22 +14day=2022-12-6; However, 2022-12-6 is not in your date column ... however 2022-11-22 +10day=2022-12-2 in your column, so it return value.

vyalanwumsft_1-1670209986167.png

 

we could modify measure as follow:

Dateadd = 
DATEADD('Table'[Date],10,DAY)

The final show:

vyalanwumsft_0-1670209957659.png


Best Regards,
Community Support Team _ Yalan Wu
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

4 REPLIES 4
NatK
Frequent Visitor

Thank you so much everyone! @v-yalanwu-msft your explanation makes sense. The Document Date column had a max date of 12/2/2022, explaining why I couldn't add more than 10 days. I couldn't open up your PBIX file, but thank you for your help. I ended up going with @djurecicK2 's solution and created another date table that related to Document Date. Then I ran DateAdd on the date field from the new date table. It works perfectly.

 

Thanks again!

NK

v-yalanwu-msft
Community Support
Community Support

Hi, @NatK ;

Because the date returned by dateadd is first the date in 'Purchase Lines' [Document Date], if the resulting date is not in this 'Purchase Lines' [Document Date] column, it returns empty. For example, 2022-11-22 +14day=2022-12-6; However, 2022-12-6 is not in your date column ... however 2022-11-22 +10day=2022-12-2 in your column, so it return value.

vyalanwumsft_1-1670209986167.png

 

we could modify measure as follow:

Dateadd = 
DATEADD('Table'[Date],10,DAY)

The final show:

vyalanwumsft_0-1670209957659.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

djurecicK2
Super User
Super User

Hi @NatK ,

 You many want to consider adding a separate date table to your model.

 

https://blog.enterprisedna.co/tips-in-creating-power-bi-date-tables/

 

Seanan
Solution Supplier
Solution Supplier

Hi @NatK,

 

Could you please try creating it as a measure instead of a calculated column. I've tried this in my test and it worked fine for me.

 

Super User Signature.PNG

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.