Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

How to find count of events last year based on today's date

Hi Experts,

The title pretty much says it all.  I'm trying to write an expression that will return the count of events where [YearOccurred] = last year, but I need it to be based on the current date.  So right now it would return records where [YearOccurred] = 2014, but on Jan 1 it would return records for 2015.

This isn't working.  Does anyone know if I'm close? 

=Count( {1<Department={"Repair"},  Year = {"=YearAdd(Year(Today()),-1)"}>} DISTINCT VisitID) 

Thanks in advance!

1 Solution

Accepted Solutions

Re: How to find count of events last year based on today's date

Try with:

=Count({1<Department={"Repair"},Year={"$(=Year(Today())-1)"}>} DISTINCT VisitID)

4 Replies
MVP
MVP

Re: How to find count of events last year based on today's date

it could be ($ or 1 it depends)

count({$ <Department={Repair},Year={$(=Year(Today())-1)}>} distinct VisitID)

Re: How to find count of events last year based on today's date

Yearadd?

I think it is addyears

Re: How to find count of events last year based on today's date

Try with:

=Count({1<Department={"Repair"},Year={"$(=Year(Today())-1)"}>} DISTINCT VisitID)

Not applicable

Re: How to find count of events last year based on today's date

This worked perfectly!  Thank you to all who responded so quickly today, and especially Peter for a great answer.  Happy Holidays!

Community Browser