Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Sara_3
Contributor III
Contributor III

how to count data

Hi,

I am creating the sample data table  here :

Code Category Key
112 A 001236
112 A 002589
112 A 002574
456 B 003698
456 B 007896
890 A 002365
890 A 005987
890 A 002365
342 B 001478

.i have 3 fields i want count of "key" of all code where "category" = A. I tried aggr function in expression but did not to get the expected answer. 

my input is Code. for example: when I select code (112 ) it belongs to category A . so my expected answer is count of all key which has category A. 

Expected result:      A =  count key = " 6 "

i have tried this expression but it gives me different answer.

Sum(Aggr(Count(Key),category)

Thanks!

Labels (1)
1 Solution

Accepted Solutions
Saravanan_Desingh

Can u try this?

=Count({1<Category=p()>} Key)

View solution in original post

7 Replies
Saravanan_Desingh

Try this,

commQV28.PNG

=Count({1<Category=p()>} TOTAL Key)
Sara_3
Contributor III
Contributor III
Author

Thanks Saravanan , yes your output is correct but it didn't work for me it gave me total count key of all categories. I really appreciated.

Saravanan_Desingh

Can u try this?

=Count({1<Category=p()>} Key)
Sara_3
Contributor III
Contributor III
Author

no, it does not work either. Thanks!

MarcoWedel

Can you describe how you tried to implement the proposed solution and how your results are different from your expectation?

Sara_3
Contributor III
Contributor III
Author

it worked perfectly with this sample inline table :

=Count({1<Category=p()>} Key)

Test:
Load * inline [
Code,Category,Key
1122, A, 6
1122, A,8
1122, A, 5
456, B, 7
456, B, 1
890, A, 2
890, A, 3
789, B, 4
789, B, 9
678, C, 10
678, C, 12
]
;

Result:

A= 5

B= 4

C=2

i have huge data of 10 categories and hundreds of code , the above expression should work for  it too but dont know why it does not work.

Sara_3
Contributor III
Contributor III
Author

Thanks Saravanan , it works actually i didnt put filters in set analysis. now values are correct. I really appreciated, Thanks again one more time.