0 Replies Latest reply: Nov 18, 2015 9:16 PM by Chalapathirao M RSS

    How to apply multiple conditions in one fuction (count) in expression in Qlikview

      Hi

      I have a scenario unable to do this scenario.  The requirement is client has source data looks in attachments here .

        

      STAFF IDSortkeySTAFF_Employment_Type
      11PERMANENT
      12PERMANENT
      13PERMANENT
      14PERMANENT
      15PERMANENT
      16PERMANENT
      21PERMANENT
      22PERMANENT
      23PERMANENT
      24PERMANENT
      25PERMANENT
      31CONTRACT
      32CONTRACT
      33CONTRACT

       

      If client writing Query on the database like below :-

      select

      EMPLOYMNT_TYPE_ID,

      count(staff_id)

      from

      FACT_STF_DEMOGRPHCS s2

      WHERE

      ( RS_DATE_ID=0 OR RS_DATE_ID>20151115)

      AND

      KEY_FIELD = (SELECT MAX(KEY_FIELD)FROM FACT_STF_DEMOGRPHCS WHERE staff_id = s2.staff_id)

      GROUP BY   EMPLOYMNT_TYPE_ID ;

       

      Client able to get result like below:

       

      Staff ewmployment type     count(Staff_id)

       

      contract                              72

      Perminent                           182

       

       

      Asper qlickview expresion i have written code as below:

       

      =Count({<
      Year = {"<=$(vMaxYr)"},
      Month=,
      Quarter=,
      YYYYMM = {'<=$(vMaxYYYYMM)'},
      RS_YYYYMM = {'>=$(=Max(YYYYMM))'},
      [(h)Staff Employment Type ID] = {'=Max([(h)Staff Employment Type ID])'},
      [(h)Sort Key]= {'=$(vMaxSortkey)'},
      STF_DEMOGRPHCS_FLAG={'Y'}
      >}

         DISTINCT [(h)Staff ID])

       

      Result i am  getting is

       

       

      Staff ewmployment type     count(Staff_id)

       

      contract                              85

      Perminent                           179

       

      can some one help to fix this issue. my gmail id is mcrao1@gmail.com, my contact number in watsup is +601139329865.   Thanks in advance - Chala