Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

peter_bolin
New Contributor II

How to count values between two dates (variables)

I've seen a few questions regarding this, which have been very helpful, but I still can find the answer to this.

I created two variables, one which calculate three days before the first day of a month and the second which calculates three days before the end of a month. Here they are:

vEndDateminus3=  date(monthend(APH_DATE)-3, 'M/D/YY')

vStartDateminus3= date(MonthStart(APH_DATE)-3, 'M/D/YY')

I have values called COI which I'd like to count how many occured between vStartDateminus3 and vEndDateminus3. This is what I have:

Count({<{'$(=vStartDateminus3)'} = {'>=$(=vEndDateminus3)'}>}[COI])

Not working! Any help would be appreciated!

5 Replies
krishna_2644
Valued Contributor III

Re: How to count values between two dates (variables)

try like this:

Count({$<APH_DATE = {'>=$(=vStartDateminus3) <=$(=vEndDateminus3)'}>}[COI])



thiago_justen
Valued Contributor III

Re: How to count values between two dates (variables)

I'd suggest you:

Count({$<APH_DATE = {">=$(=$(vStartDateminus3))<=$(=$(vEndDateminus3))"}>}[COI])


Double quotes are needed here.

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
Digvijay_Singh
Honored Contributor III

Re: How to count values between two dates (variables)

Or may be -

Count({$<APH_DATE = {">=$(vStartDateminus3)<=$(vEndDateminus3)"}>}[COI])

MVP
MVP

Re: How to count values between two dates (variables)

If the variables are defined as dates, you will need

Count({<APH_DATE = {">='$(vStartDateminus3)' <='$(vEndDateminus3)'"}>} COI)

peter_bolin
New Contributor II

Re: How to count values between two dates (variables)

Thanks everyone, very helpful! I ran this to check if I could 1) use this logic as measure called #aphs 2) make sure there are COI's within the start date-3...end date-3 range and 3) audit my minus3 variable. 

#aphs = Count({<APH_DATE = {">='$(vStartDateminus3)' <='$(vEndDateminus3)'"}>} COI)

I'm very new to Qlik so sorry for the delay response and perhaps my filters are the issue. Thanks agian.