Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

0 Replies