Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
shamitshah
Partner - Creator
Partner - Creator

Limit the the number of rows by reference to date

Hi,

I have the following in SQL (the ListDate is classified as varchar data type)

    

MinMaxItem NumberPrimary DescriptionListDate
3101000000Cups Slim

04-04-2017

which I load into QlikView as

Report:
LOAD

[Min],

[Max],
[Primary Description],
[Item Number],
ListDate,
Date(Date#(ListDate, 'DD-MM-YYYY')) as LDate,

Month(Date#(ListDate, 'DD-MM-YYYY'))  as LDateMonth;

SQL SELECT *
FROM "Report"
;

I want to restrict the the number of rows by reference to date e.g. I only want the rows with the dates that are within 90 days as of today. How can I do that?

Thanks

1 Solution

Accepted Solutions
sunny_talwar

Ideally, I would suggest you to restrict this in SQL itself as you don't want to bring extra data into QlikView which you are going to drop in QlikView without processing it. But if you want to do it in QlikView, you can try this

Report:
LOAD [Min],

    [Max],
    [Primary Description],
    [Item Number],
    ListDate,
    Date(Date#(ListDate, 'DD-MM-YYYY')) as LDate,

    Month(Date#(ListDate, 'DD-MM-YYYY'))  as LDateMonth

Where Date#(ListDate, 'DD-MM-YYYY') >= Today() - 90;

SQL SELECT *
FROM "Report";

View solution in original post

2 Replies
sunny_talwar

Ideally, I would suggest you to restrict this in SQL itself as you don't want to bring extra data into QlikView which you are going to drop in QlikView without processing it. But if you want to do it in QlikView, you can try this

Report:
LOAD [Min],

    [Max],
    [Primary Description],
    [Item Number],
    ListDate,
    Date(Date#(ListDate, 'DD-MM-YYYY')) as LDate,

    Month(Date#(ListDate, 'DD-MM-YYYY'))  as LDateMonth

Where Date#(ListDate, 'DD-MM-YYYY') >= Today() - 90;

SQL SELECT *
FROM "Report";

shamitshah
Partner - Creator
Partner - Creator
Author

Thanks Sunny,

That worked quite well.

Shamit