16 Replies Latest reply: Feb 20, 2017 1:19 AM by Vineeth Pujari RSS

    count in selectedfield

    Adam Brian

      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

        • Re: count in selectedfield
          Chanty 4u

          try this

          Not tested.

           

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


          and


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

          • Re: count in selectedfield
            Pratyush Shastri

            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

              • Re: count in selectedfield
                Vineeth Pujari

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

                • Re: count in selectedfield
                  Adam Brian

                  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

                  • Re: count in selectedfield
                    Adam Brian

                    Hi Pratyush,

                     

                    i tried this one but has error. can you help me this one?

                     

                    count people by id where when i select department A.

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

                  • Re: count in selectedfield
                    Vineeth Pujari

                    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)

                      • Re: count in selectedfield
                        Adam Brian

                        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

                      • Re: count in selectedfield
                        ishan Bhatt

                        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.

                        • Re: count in selectedfield
                          Adam Brian

                          Hi,

                          Sorry, I have a few question again, can you help me

                           

                          2017-02-20 06_08_04-soalan.xlsx - Excel.png


                          I want to calculate and show in pie chart, if i select any UNIT and need to compare same UNIT=OLD_UNIT.

                          For example i select unit1 in department A:


                          1) show GROUP count by STAFF_ID where if i select an@y unit getfieldselections(UNIT) and if UNIT=OLD_UNIT


                          2) show DEPARTMENT count by STAFF_ID where count all STAFF_ID except unit1 in department A.

                          getNotfieldselections(UNIT) and if UNIT=OLD_UNIT


                          And what should i put in Dimensions and Measure field?


                          @Vineeth Pujari @Pratyush Shastri