Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm new to Qlik and looking for some help/advice on how to filter some data.
I have a read only connection into a PostgreSQL database. I have a table containing all orders since the company started. I essentially want to filter the data by date so that I only get the results back for the last 5 years.
I've tried this but keep getting an error
Where Date(Date#(order_date,'D-M-YYYY')) > '12-31-2020' but keep getting an error.
Any help or pointers would be appreciated.
Hi Steve,
I believe you get an error because you are trying to use Qlik functions, like Date#(), in a SQL statement. Instead, try to use PostgreSQL functions, or simply compare date fields without applying any functions.
By default, I believe PostgreSQL dates are stored as 'YYYY-MM-DD'. If this is how your dates are stored, I'd try something like this:
WHERE order_date > '2020-12-31'
If your dates are stored differently, then use PostgreSQL date functions to bring the dates to YYYY-MM-DD format, in order to make them comparable as strings.
Hopefully this helps,