Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
da_pagnott
New Contributor III

Using Count function between two dates

Hi guys,

I'm working with count function and date values, and I need to count the number of items between two days (let's say between 01/01 and yesterday).

DocDta it's a date value, correctly recognized as date.

DocNum it's an ID.

YTDStart it's a date (01/01/2019).

YTD it's a date (yesterday).

I tried this function but it doesn't work (I want to count values greater than start and less than yesterday).

The followind fuction doesn't make any filter so I get the count of all my values.

=Count({<DocDta={">=$(=YTDStart)"},DocDta={"<=$(=YTD)"}>} DocNum)

However, if I remove the secondo condition and I count just values greater that 01/01 I correctly get the right value.

=Count({<DocDta={">=$(=YTDStart)"}>} DocNum)

Do you have any idea about that?

 

Thank you!

Labels (4)
1 Solution

Accepted Solutions
dilipranjith
Honored Contributor

Re: Using Count function between two dates

Modify your expression like below and try

 

=Count({<DocDta={">=$(=YTDStart) <=$(=YTD)"}>} DocNum)

i am assuming the formatting is the same in YTDstart and YTD

3 Replies
dilipranjith
Honored Contributor

Re: Using Count function between two dates

Modify your expression like below and try

 

=Count({<DocDta={">=$(=YTDStart) <=$(=YTD)"}>} DocNum)

i am assuming the formatting is the same in YTDstart and YTD

da_pagnott
New Contributor III

Re: Using Count function between two dates

Nice, it works!

Thank you for your help!!

dilipranjith
Honored Contributor

Re: Using Count function between two dates

no problems