Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sylvain_piccarreta

How to use date in a filter

Hello,

I have a variable (Date format) initialized like this

Let vDatesept = date(today()-7,'DD-MM-YYYY');

And I want to create a table which count the number of data in the field TEST where the field CREATED >= vDatesept.

how to do it ?

I try to write :

=COUNT({<CREATED={'>=' & $(vDatesept)}>}DISTINCT(TEST))

Or

=COUNT({<CREATED=vDatesept}>}DISTINCT(TEST))

it doesn't run

Thanks for your help.

Sylvain

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

Back end (load script)

SET DateFormat='DD-MM-YYYY';

Let vDatesept = date(today()-7);

Front end

Expression:

Count({<CREATED={">=$(vDatesept)"}>} DISTINCT Test)

Test (2)2.png

See also attached

View solution in original post

5 Replies
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

What about:

=COUNT({<CREATED={'>=$(vDatesept)"}>}DISTINCT TEST)

stigchel
Partner - Master
Partner - Master

In load script there is no set analysis, you can use something like this

//Make sure your dateformat is correct/corresponds

SET DateFormat='DD-MM-YYYY';

//Make the variable a num (see also the attached techbrief)

Let vDatesept = Num(date(today()-7));

Data:

Load Date(Data) as CREATED Inline [Data

2-10-2018

9-10-2018

10-10-2018

11-10-2018

12-10-2018

];

Load Count(CREATED) as Count resident Data where CREATED>=$(vDatesept);

Test (2).png

sylvain_piccarreta
Author

thanks, but sorry, I was not clear.

I like to show in a table how many TEST by date when date > 10-10-2018 by example

TEST         CREATED

#1                 02-10-2018

#2                 02-10-2018

#3                 02-10-2018

#4                 09-10-2018

#5                 09-10-2018

#6                10-10-2018

#6                 10-10-2018 (2 times the samevalue, it's why I need to put DISTINCT)

#7                11-10-2018

#8                12-10-2018

#9                 12-10-2018

#10                12-10-2018

#11                 12-10-2018


I like a results like this

10-10-2018        1 (because the distinct)

11-10-2018        1

12-10-2018        4


Thanks four your help

stigchel
Partner - Master
Partner - Master

Back end (load script)

SET DateFormat='DD-MM-YYYY';

Let vDatesept = date(today()-7);

Front end

Expression:

Count({<CREATED={">=$(vDatesept)"}>} DISTINCT Test)

Test (2)2.png

See also attached

sylvain_piccarreta
Author

thanks