Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
chiayaochang
Contributor II
Contributor II

Qlik Sense - Count function with date filtering

Hi, I need to count the [ISSUES] field based on my selected date. Essentially I have a bar chart with quarterly # of issues. I only want to add KPI to show # of ISSUES in latest quarter. say, 3 ISSUES in 2018-Q4, 8 ISSUES in 2018-Q3 and so on. However, when I use following expression, the figures look odd to me (ie, when i only selected year 2017 in filter pane, it shows 10) . Can anyone please advise? Thanks

ISSUES    Date
3                2018-Q4

8                2018-Q3

13              2018-Q2

7                2018-Q1        

7                 2017-Q4

Count({$<[Date.autoCalendar.Quarter]={">=$(=date(max(Date.autoCalendar.Quarter)))"},[Date.autoCalendar.Year]={">=$(=date(max(Date.autoCalendar.Year)))"}>}ISSUES)

2 Replies
Lisa_P
Employee
Employee

If the latest quarter is the previous quarter:

Count({$<[Date.autoCalendar.QuartersAgo]={1}>}ISSUES)

chiayaochang
Contributor II
Contributor II
Author

I finally created two additional fields based on Date, "ISSUES_QUARTER" and "ISSUES_YEAR", then use following expression to solve the problem

Count({$<ISSUES_QUARTER={"$(=Ceil(Month(max(Date))/3))"},ISSUES_YEAR={"$(=Year(max(Date)))"}>}ISSUES)