Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

How to load data from a specific year.

I'm stuck on a seemingly easy task. I load data from a table with a date column and want to filter the data to only load records from a specific year.

I've been trying alot of different variants as candidates for the WHERE clause, all with different errors.

start_time is the name of the column that hold the date.

LOAD ....

SQL SELECT

...

FROM "fact_table"

WHERE Year('2014-01-01')=Year(Date(start_time));

SQL##f - SqlState: 42883, ErrorCode: 7, ErrorMsg: ERROR: function year(unknown) does not exist;

let start_date=MakeDate(2014, 01, 01);

...

WHERE Year($(start_date))=Year(start_time);

ErrorCode: 7, ErrorMsg: ERROR: function year(integer) does not exist;


What am I doing wrong here?

1 Solution

Accepted Solutions

Re: How to load data from a specific year.

Your database server doesn't understand qlikview functions like Year. If you use Postgresql then you can try the Extract function.


talk is cheap, supply exceeds demand
3 Replies

Re: How to load data from a specific year.

Your database server doesn't understand qlikview functions like Year. If you use Postgresql then you can try the Extract function.


talk is cheap, supply exceeds demand
Not applicable

Re: How to load data from a specific year.

That makes sense.

I'm using postgresql and the following did the trick.

WHERE start_time >= '2014-01-01' AND start_time < '2015-01-01';

Thanks!

mohamed_ahid
Contributor III

Re: How to load data from a specific year.

have you tried to execute directly the sql request on the database ?

Community Browser