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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ysherriff
Resolver II
Resolver II

Dateadd function not working

Hi all,

 

I am trying to do a simple calculation to get the previous year utilizing dateadd. In Image 1, when I use previous year, the output is correct. When I tried to use Dateadd, the output shows blank, see image 2. I think  Dateadd doesn't like my date table but I don't understand where the issue lies. Any help would be appreciated.

 

Image 1

ysherriff_0-1650462778373.png

 

Image 2

ysherriff_1-1650463019124.png

 

 

1 ACCEPTED SOLUTION

PREVIOUSYEAR returns the values covering all dates in the previous year, while DATEADD as you have it returns the values for the same date in the previous year.
Are there any values for the previous year's dates where it is now showing blank?

Also, does the date table contain continuous dates covering the whole range of dates in the model?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

DATEADD should work fine.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






I will try to do a workaround since my model doesn't fit DateAdd requirements.

 

Thanks

If your model contains a date table with continuous dates covering the range of dates in the model, the date table date field is linked to the date field in your fact model in a one-to-many single direction relationship and you use the date table field in your visuals, DATEADD should work ok.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






ysherriff
Resolver II
Resolver II

Attach is the data model

 

ysherriff_0-1650464748119.png

 

PREVIOUSYEAR returns the values covering all dates in the previous year, while DATEADD as you have it returns the values for the same date in the previous year.
Are there any values for the previous year's dates where it is now showing blank?

Also, does the date table contain continuous dates covering the whole range of dates in the model?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hi Paul,

 

To answer your last question first, the date table is continuous and covers the whole range of dates in the model, meaning the start and end date of the date table matches the start and end date of the model

 

As it relates to the first question, there are some date gaps within the model date. So it is not all continuous in the model. The data from the model is extracted from a user database so there is nothing I can do on that end.

 

Is there a workaround. All I am trying to do is get last year and last quarter using dateaddd in case i need to extract last 2 quarters or years. Dateadd is just more versatile.

 

I hope that helps.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors