Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

mahitham
Contributor II

KPI Expression help

Hi Experts,

Can any one please help me on below requirement.

In the attached image KPI I have used the below expression

=if(len(GetFieldSelections(EmpTYPE))=0,
Count({<Flag={'Completed'}>}distinct EmpID),

if(GetFieldSelections(EmpTYPE)='New','N/A',

if(GetFieldSelections(EmpTYPE)='Permanents',
Count({<Flag={'Completed'}>}distinct EmpID)
)))

as per this expression when user selects EmpType = New then in the KPI instead of 0 I am passing N/A

Same like when user selects New EmpType related any employee Id then also this KPI has to show N/A instead of 0 value.

KPI.png

Please help me on this. Please find the below attached app.

Note: I am looking for the solution only in Front end.

Thank in advance

1 Solution

Accepted Solutions
Partner
Partner

Re: KPI Expression help

maybe this:

=if(len(GetFieldSelections(EmpTYPE))=0 and EmpTYPE<>'New',

Count({<Flag={'Completed'}>}distinct EmpID),

if(GetFieldSelections(EmpTYPE)='New' or EmpTYPE='New','N/A',

if(GetFieldSelections(EmpTYPE)='Permanents',

Count({<Flag={'Completed'}>}distinct EmpID) )

        )

)

I hope it helps.

View solution in original post

5 Replies
Partner
Partner

Re: KPI Expression help

your KPI expression looks good, what's your expected result?

andrey_krylov
Valued Contributor

Re: KPI Expression help

Hi Mahitha. Try this

=if(EmpTYPE='New','N/A',

if(len(GetFieldSelections(EmpTYPE))=0,

Count({<Flag={'Completed'}>}distinct EmpID),

if(GetFieldSelections(EmpTYPE)='Permanents',
Count({<Flag={'Completed'}>}distinct EmpID)
)))

mahitham
Contributor II

Re: KPI Expression help

Hi agigliotti


I have mainly two filters Emp Type and Emp Id.

User either selects Emp Type or Emp Id.


Requirement is when user select EmpType = New then need to show N/A in the KPI

if user selects any EmpID related to EmpType = New then also need to show N/A in the KPI

by default need to show actual count.

NA.png

Partner
Partner

Re: KPI Expression help

maybe this:

=if(len(GetFieldSelections(EmpTYPE))=0 and EmpTYPE<>'New',

Count({<Flag={'Completed'}>}distinct EmpID),

if(GetFieldSelections(EmpTYPE)='New' or EmpTYPE='New','N/A',

if(GetFieldSelections(EmpTYPE)='Permanents',

Count({<Flag={'Completed'}>}distinct EmpID) )

        )

)

I hope it helps.

View solution in original post

mahitham
Contributor II

Re: KPI Expression help

Thank for your help. Its working