cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Date Add SQL error

Hi all,

 

I'm attempting to connect to a denodo database via SQL statement and I'm running into issue using the Dateadd function.  When using the below statement "DOCPOSTINGDATE BETWEEN DATEADD(Month, -12, CURRENT_DATE) AND CURRENT_DATE" I recieve the following error:

 

DataSource.Error: ODBC: ERROR [ ] ERROR: Error in select view conditions: Field not found 'month' in view with schema

 

This SQL statement executes fine in other databases.  Is there some other syntax that power BI expects?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Date Add SQL error

Hi all,

 

I've solved my issue by consulting the help documentation around the database type my company is using, we're using a denodo solution and they use VQL for querying language which has slightly different syntax.  In the end my query looked as below and now operates as expected:

 

DOCPOSTINGDATE >= ADDYEAR(CURRENT_DATE, -1)

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: Date Add SQL error

@Sheehrt 

The DATEADD function has the following format, you need to amend your formula accordingly

= DATEADD(DateTime[DateKey],-1,year)

check the article for more info.

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

Click on the Thumbs-Up icon on the right if you like this reply 🙂

YouTube, LinkedIn

Highlighted
Super User IX
Super User IX

Re: Date Add SQL error

@Sheehrt ,

dateadd seems fine, but check  -https://www.w3schools.com/sql/func_sqlserver_dateadd.asp

 

Try GETDATE() in place of CURRENT_DATE in case of SQL server



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Frequent Visitor

Re: Date Add SQL error

Hi all,

 

I've solved my issue by consulting the help documentation around the database type my company is using, we're using a denodo solution and they use VQL for querying language which has slightly different syntax.  In the end my query looked as below and now operates as expected:

 

DOCPOSTINGDATE >= ADDYEAR(CURRENT_DATE, -1)

View solution in original post

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors