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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Strooprover
Contributor
Contributor

Count specific dimension

Hi,

I'm new to QlikView and have a question about a count function I want to apply to a chart.

I uploaded an example to this post.

I have 2 dimensions which are:
- animal_category
- animal

My expression is: Count(Animal_category).

When I count the animal_category without submitting the animal dimension to the table I get a value of 3.
But when I add the animal dimension I get a value of 1 (because QlikView counts for the combination of added dimensions).

I would like to make an expression (or a different approach) with which I can make a count of animals in the animal_category without it being influenced by the added animals.

Thanks in advance.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Based up o how you want aggregate the TOTAL qualifier on dimension. You can add one more dimension into that TOTAL qualifier like

Count(TOTAL <Animal_category, Animal_attributes> Animal_category)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

8 Replies
Anil_Babu_Samineni

I wonder, you;ve asked proper question for below


@Strooprover wrote:

When I count the animal_category without submitting the animal dimension to the table I get a value of 3.
But when I add the animal dimension I get a value of 1 (because QlikView counts for the combination of added dimensions).


But, as per image - I still see the "animal" dimension also. Perhaps

Count(TOTAL Animal_category)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Strooprover
Contributor
Contributor
Author

Hi Anil,

Thank you very much for your quick response.
I've added a new image to show you what I mean.

What I would like to have is a column in where the dimension fish gets a value of 3 and Ants a value of 2 instead of 5.
In other words, the count of animals inside of the animal_category.

Anil_Babu_Samineni

If you want Fish as 3 / Ants as 2 instead 5. Perhaps 

Count(TOTAL <Animal_category> Animal_category)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Strooprover
Contributor
Contributor
Author

That works indeed for the current example.
If I may, I would like to make the example one step more complex.

I gave my fishes attributes.
In the sourcefile you can see how I added them.

This change results in different count values for my expression (QV example 3).
Is it possible to prevent this?

I would like to keep the result for fish 3 instead of 5.

Much thanks in advance!

Anil_Babu_Samineni

Based up o how you want aggregate the TOTAL qualifier on dimension. You can add one more dimension into that TOTAL qualifier like

Count(TOTAL <Animal_category, Animal_attributes> Animal_category)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Strooprover
Contributor
Contributor
Author

Great.
That's exactly what I needed!


One last question:
Is it possible to filter for such a value?

So, for instance: I want to filter only animal_categories with 3 animals in it (based upon the count column).

Anil_Babu_Samineni

You can, TOTAL never stop the filter selection where is Aggregate can be stopped during analyse time. 

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Strooprover
Contributor
Contributor
Author

Your help is much appreciated.
Thank you very much!