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

Where statement in Direct Discovery

Hi,

I'm testing Direct Discovery and I'm trying to use 'WHERE' statement in my Direct Query but it doesn't work.

I have a date field and I want to obtain only the data that belongs to year 2014. So I did that:

DIRECT QUERY

   DIMENSION

       Customer,

       Date,

       Salesman,

       Shop

       NATIVE('CAST (EAN as nvarchar(30))') as EAN

  MEASURE

   UDS,

   Amount

   FROM GRP.dbo.Sales

   WHERE Year(Date) = 2014;

I tried to use NATIVE statement: WHERE NATIVE('Year(Date)') = 2014; without success.


I found a workaround WHERE Date >= '01/01/2014' and Date <= '31/12/2014' but I'm interested to do it with qlik functions.

Some help?

Thanks

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Keep in mind that the DIRECT QUERY statement is in essence a SQL SELECT statement that needs to be performed on the database. For this reason, it can't possibly use Qlik functions like Year() - you have to stay within the SQL syntax.

View solution in original post

3 Replies
agomes1971
Specialist II
Specialist II

Hi,

see this thread

http://community.qlik.com/thread/111959

HTH

André Gomes

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Keep in mind that the DIRECT QUERY statement is in essence a SQL SELECT statement that needs to be performed on the database. For this reason, it can't possibly use Qlik functions like Year() - you have to stay within the SQL syntax.

Anonymous
Not applicable
Author

Thank to both of you for your answers.