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: 
Not applicable

How to use COUNT with multiple selections

HI All,

I want to count the number of records ( HCCurrent.Sr. No) and it does good by using the below expression.

count({< HCCurrent.Eligible = { '$(=GetFieldSelections(Eligible))'},

HCCurrent.OU = { '$(=GetFieldSelections(OU))'}>}[HCCurrent.Sr. No])

however if I do not select anything in OU then it returns zero.

How can I use count such that it outputs the dynamic count of a particular field as I add or reduce filter conditions.

Thanks in advance.

6 Replies
Not applicable
Author

GetFieldSelections only work with a selected field. Perhaps you can ensure that your list box properties has "always one value selected" checked.

Cheers,

Pravesh

hic
Former Employee
Former Employee

If you just use

   Count( [HCCurrent.Sr. No] )

this will automatically show the dynamic count based on your filter conditions (your selections). But this is not what you want do ... or?  So, you want something different - but I am not sure I understand what.

Not applicable
Author

Hi Henric

I can use simply count ([HCCurrent.Sr. No]  ) because i want to use the values from the selection.

I did not highlight earlier that i have 2 different tables involved. What i select will be from Table1 ( without the qualifier)

and I want the count with these selection from Table2( with qualifier HCCurrent )

Hope I am able to explain this .

count({< HCCurrent.Eligible = { '$(=GetFieldSelections(Eligible))'},

HCCurrent.OU = { '$(=GetFieldSelections(OU))'}>}[HCCurrent.Sr. No])

Thanks & regards

Rohit

hic
Former Employee
Former Employee

If you have a link between the two tables - a key field - this will work automatically. There is no need to program it. From what you have said so far, a standard

     Count( [HCCurrent.Sr. No] )

should do the trick. That is - if your data model hast this link between the two tables.


HIC

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you post a screenshot of your data model from the Table Viewer?

-Rob

Not applicable
Author

Thanks Henric & Rob,

I may not be able to share the screenshot due to security issues.

But the Table2( with qualifier HCCurrent ) is an independent table.

I have intentionally kept it independent and not linked it into the data model because I want to count the data from this table as it is the current snapshot.

Thanks to point me to the Data Model, i will consider to re-design it.

Thanks for all the help so far. Will surely come to you again in case I have challenges.

Regards

ROhit