Search code examples
countqlikviewqliksenseset-analysisqlik-expression

Qlikview Count of ids in last 12 months in text object (box)


I have two fields in my table Date & ID, i want to put in a text box the count of all the ids for the last 12 months.

This returns nothing:

=Num(count({$<DATE={'>=$(=AddMonths(Today(),-12))'}>}[ID]),'#,##0')

This returns the correct count:

=count(ID)

This returns the total for the year (2015):

SUM(IF( year(DATE) = year(today()),1,0))

Solution

  • Using the MonthName function on the date to parse it exactly as the AddMonths function does

    =SUM(IF( (date(Monthname(DATE),'MMM-YY')) >=(AddMonths(Today(),-12)),1,0))