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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
t-zhanqi
Microsoft Employee
Microsoft Employee

SQL statement syntax error when using DATEADD()

I want to get the Monday of the CreatedDTim.

 

t-zhanqi_0-1595241415601.png

But i encountered an error while trying to connect.

t-zhanqi_1-1595241473863.png

 

 

 

1 ACCEPTED SOLUTION

HI, @v-easonf-msft  

Thank you for your help. Your reply is of great help to me in solving this problem. I have solved this problem by using TIMESTAMPADD(). The reason I can't use DATEADD() is that my data source is ODBC instead of SQL SERVER. 

View solution in original post

5 REPLIES 5
v-easonf-msft
Community Support
Community Support

Hi , @t-zhanqi 

What kind of your database ?

PowerBi has a variety of database connectors, if possible, it is recommended to use them directly rather than ODBC connectors.

I try to  test your sql satement under the environment  of sql server, there is nothing wrong can be find.

Can you run the statement normally in your database?

 

Best Regards,
Community Support Team _ Eason

 

 

HI, @v-easonf-msft  

Thank you for your help. Your reply is of great help to me in solving this problem. I have solved this problem by using TIMESTAMPADD(). The reason I can't use DATEADD() is that my data source is ODBC instead of SQL SERVER. 

Hi,  @t-zhanqi 

It's pleasant that you can share your sloution to us, people who meet a similar problem will be very happy with it.

Please accept your reply as solution, so that other community members will easily find the solution when they get the same issue.

 

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

@t-zhanqi , refer these for sql server date add

https://www.w3schools.com/sql/func_sqlserver_dateadd.asp

https://docs.microsoft.com/en-us/sql/t-sql/functions/dateadd-transact-sql?view=sql-server-ver15

 

I doubt it has anything to do with power BI. Incase this SQL is working on SSMS and not working here, then it needs to be checked.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for your help. I have solved this problem by using TIMESTAMPADD(). The reason I can't use DATEADD() is that my data source is ODBC instead of SQL SERVER.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.