Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
adambrian
Contributor III
Contributor III

count in selectedfield

Hi,

i want to count people by id where when i select department A.

Count({<department=getfieldselections>} id)

and i want count people not in department A when i select department A.

Count({<department=getNotfieldselections>} id)


anyone help me to solve this one.

Thanks,
Adam

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

to count people by id where when i select department A.

Count(Distinct id)

count people not in department A when i select department A.

Count({<department,department=E(department)>}Distinct id)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

16 Replies
Chanty4u
MVP
MVP

try this

Not tested.

=count({1<Department=P()>} id)


and


=count({1<Department=E()>} id)

prat1507
Specialist
Specialist

You can use the below expression:


count people by id where when i select department A.

Count({<department ={'$(=GetFieldSelections(department ))'}>}id)


count people not in department A when i select department A.

=Count({<department =>}id)-

Count({<department ={'$(=GetFieldSelections(department ))'}>}id)

Regards

Pratyush

vinieme12
Champion III
Champion III

to count people by id where when i select department A.

Count(Distinct id)

count people not in department A when i select department A.

Count({<department,department=E(department)>}Distinct id)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

There is no need for GetfieldSelections() buddy , remember qlikview is Associative

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
adambrian
Contributor III
Contributor III
Author

Thanks for your right answer. it run well..

the are a few question i want to ask you:

there ada a few units under one department.

for example there are 3 department, which department A,department B, department C

and there 4 units under each department which unit1, unit2, unit3, unit3

my question:

1) when i select department A, how can i count total staff(id) in department B and C.

2) can i show total staff in selected department and selected unit in selected department in same time. for example if i select unit1 in department A, can i show in text & image extension :

what department selected : total staff in selected department

what unit selected : total staff in selected unit

adambrian
Contributor III
Contributor III
Author

Thanks for your right answer. it run well..

the are a few question i want to ask you:

there ada a few units under one department.

for example there are 3 department, which department A,department B, department C

and there 4 units under each department which unit1, unit2, unit3, unit3

my question:

1) when i select department A, how can i count total staff(id) in department B and C.

2) can i show total staff in selected department and selected unit in selected department in same time. for example if i select unit1 in department A, can i show in text & image extension :

what department selected : total staff in selected department

what unit selected : total staff in selected unit

ishanbhatt
Creator II
Creator II

Hi Adman,

You can directly use "Count function" for getting selected department count and for rest count used "GetExcludedCount function".

or Getting Selected Department Count use

=Count(Employee ID)

And for getting excluded count use

=GetExcludedCount(Employee ID)

Please find the attached Qlikview Document for example.

vinieme12
Champion III
Champion III

my question:

1) when i select department A, how can i count total staff(id) in department B and C.

          Count({<department,department=E(department)>}Distinct id)

i select unit1 in department A, can i show in text & image extension :

what department selected : total staff in selected department

In a Text Object:  Total by Departement on selection of Unit

        ='Department ' & Department &'  : ' Count({<unit, Department = p(Department)>}Distinct id)


what unit selected : total staff in selected unit

In a Text Object:  on selection of Unit Total for Selected Unit is

           ='Unit ' & Unit &'  : ' Count(Distinct id)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
adambrian
Contributor III
Contributor III
Author

Thank Vineeth with your correct.

I want to show what i select, if i select department, it show department and if i select unit, it show unit in one text..
do you know how to do it?