Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
QSense
Creator II
Creator II

count id based on max date

Hello ,

I have an expression like this ;

COUNT(IF(A= 1 AND B= 'UPSELL', ID)) but I want to calculate this count according to max of current year month,

I would like to count max year month's value using with my above expression. My date format is 'DD.MM.YYYY'

Thanks

1 Solution

Accepted Solutions
QSense
Creator II
Creator II
Author

{"$(='>=' & Date(MonthStart(Today())) & '<=' & Date(MonthEnd(Today())))"}

View solution in original post

6 Replies
swuehl
MVP
MVP

If your dates are having a numeric representation, you can use QV date functions to check if they reside in today's month:

=COUNT( IF(A=1 AND B='UPSELL' AND InMonth(DATEFIELD, Today()), ID))

Today's month should be the same as max of current year month, or are you looking for something else?

QSense
Creator II
Creator II
Author

Unfortunately ıt didnt work.

Actually I waould like to see max date's value for instance it is 2016 March and ı want to count max date's value so March's value should be seen

swuehl
MVP
MVP

sorry, I don't understand what you want to count.

Could you post some sample records and your expected result?

QSense
Creator II
Creator II
Author

=COUNT( IF(A=1 AND B='UPSELL' AND date=(max(date(Datefield,'YYYYMM'))) , ID))

It should be like this


When I look table for each month I want to see last year month's value

QSense
Creator II
Creator II
Author

{"$(='>=' & Date(MonthStart(Today())) & '<=' & Date(MonthEnd(Today())))"}

QSense
Creator II
Creator II
Author

=Count({<DATE= {"$(='>=' & Date(MonthStart(Today())) & '<=' & Date(MonthEnd(Today())))"},A = {1} ,B = {'X'},C={'Y'},C={'Z'} >} D)