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: 
aftabn10
Contributor III
Contributor III

Count Based on Max Week Ending Date

Hi, I am new to the world of Qlik and I am trying to develop a dashboard with a few measures. The first measure that I would like is to display a count of a column based on the max week ending date. The following is an example of the data (based on an sql query that I have)

we_date | count(*)

2019-09-06 | 914
2019-09-13 | 416

I then wrote the following expression:

Count({$<Date={$(= max (we_date))}>}product_name)

but this displays a total of 1330 which is a sum of 914+416 so not sure where I am going wrong.

I would appreciate it if somebody could advise on how I could fix this.

Thanks in advance.

12 Replies
aftabn10
Contributor III
Contributor III
Author

Thanks for your reply Qlik_venu, unfortunately tried that but still the same.

aftabn10
Contributor III
Contributor III
Author

Hi, I have managed to solve the issue yay!

I changed to code to:

=Count( {$<we_date_num = {$(vWeekEndingMax)} >} product_name )

It was a case of adding an equal sign before count but this still showed as 0 but when I added an equal sign to my other variable vWeekEndingMax

=Max(we_date_num) then this started working

I would love to know what I should be using as I have been looking through the forums and seen so many examples without the equal sign so would love an explanation.

Thank you all for your help

johnca
Specialist
Specialist

Have you tried single quotes rather than double quotes?

Count({$<Date={'$(= max (we_date))'}>}product_name)

And, make sure both fields are formatted the same.