Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
amien
Specialist
Specialist

how do i count this in a text object

i need a counter in a textbox .. this is what i have now and works:


COUNT(IF(
VALUE * OPENAMOUNT / AVG(TOTAL VALUE * OPENAMOUNT) > vMin
AND
VALUE * OPENAMOUNT / AVG(TOTAL VALUE * OPENAMOUNT) < vMax
,OPENAMOUNT))


Now i want to add the following row.. result : text object shows a ' -' instead of a value


AND
COUNT(DateTime)) > vMin_Counter


what wrong?

5 Replies
Anonymous
Not applicable

You are trying to use nested aggregation - one aggregation function (count in this case) within another. It cannot be done directly.
See help and examples on aggr() function that helps to resolve the problems exactly like this one.
(Actually, the avg() function is also aggregation, so I'm wondering why it works... Maybe the "total" qualifier helps here.)

amien
Specialist
Specialist
Author

i dont see it .. do i need to aggr on top AGGR(COUNT(IF(...) ? or aggr(count(datetime)

tried several options

thanks for your reply!

Anonymous
Not applicable

Certainly aggr(count(datetime), field1, field2, ...).
What fields to use in aggregation - I can't tell. It depends on your data model and what you're trying to count. It may be one field or multiple.

amien
Specialist
Specialist
Author

sorry to bother .. but can someone write this out for me .. i cant get it working .. thanks in advanced!

Anonymous
Not applicable

I don't think it is possible to write a correct expression with aggr() function without having at least the data model. You have to do it yourself.
I can suggest an alternative. Create one more variable:
vCountDT = count(DateTime)
and, use it in your expression:


AND
vCountDT > vMin_Counter