Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count Function

I'm attempting to build an expression using the count function that shows me the count for a dimension based on a date.  The current expression I have is as follows:

=Count({$<[POS Date]={'10/31/2014'}>}[Instrument Type])

Any idea why it does not work?

14 Replies
ToniKautto
Employee
Employee

The set expression search string needs to be closed with a double-quote.


=Count({$<[POS Date]={"$(=Date#('10/31/2014','MM/DD/YYYY'))"}>}[Instrument Type])


However, there is no point in making a static calculation like =Date#('10/31/2014','MM/DD/YYYY') in the set expression. This will only result in a text looking like 10/31/2014, meaning that the calculation just makes the expression look more complex and wastes time for one calculation. Just write the date direct in the expression, and this is equal to the expression above.


=Count({$<[POS Date]={"10/31/2014"}>}[Instrument Type])

Not applicable
Author

Toni,

Thanks for the response, however I am still unable to get the expression to function.  When I use just the following:

=Count([Instrument Type])

I get the following results:

Instr Count.png

When I try your expression, no results are returned when I know there should be.

anbu1984
Master III
Master III

Can you post sample app

Not applicable
Author

It turns out the way I loaded the data was in a format that was inconsistent.  I changed the format and reloaded and this worked.

Thanks.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Probably the [POS Date] field doesn't contain anything recognizable by QlikView as a date. Can you post a screenshot of a [POS Date] listbox? Or a small test document?

In the meantime and on condition that you're not using a PE Desktop, check out Massimo's example higher up.

Peter