Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
daisy1438
New Contributor

expression for nonmake site if select on kpi?

Hi

 

I have fields [ID] and [make Vs nonmake].

if i select any more than one or not selected in kpi in my chart it calculate number of ID s available for those KPIs.

i am using the   if(Count(Distinct KPI)<>1,Count(distinct [SCML Id]),$(vSiteCountScorecard))

this expression for that.

 

same way i need to calculate the number of make ID is if not select any kpi or select more than one kpi.

mak vs nomake filed values are make and non make.

i am writing the below expression for that.but not getting the proper value.

 if(Count(Distinct KPI)<>1,[make vs nomake]='Make',Count(distinct [ Id]),$(vSiteCountScorecard))

 

please help on this.

5 Replies
Vince_CH
Contributor II

Re: expression for nonmake site if select on kpi?

Hello, you may try this:
if(Count(Distinct KPI)<>1 and [make vs nomake]='Make',Count(distinct [ Id]),$(vSiteCountScorecard))

Or without adding [make vs nomake] in set expressions, you can pull a list box with field [make vs nomake], and just select to show.
pradosh_thakur
Honored Contributor II

Re: expression for nonmake site if select on kpi?

When you have more than one condition to check for in Qlik sense you can combine them with and/or

 if(Count(Distinct KPI)<>1 and [make vs nomake]='Make',Count(distinct [ Id]),$(vSiteCountScorecard))

Please check the function getselectedcount() to check if any values are selected in a field or not. Similarly you can check for getfieldseletections() as well and use it wherever necessary.

 

Thanks

Pradosh

Learning never stops.
daisy1438
New Contributor

Re: expression for nonmake site if select on kpi?

not working .

see the screen short for the reference.

i am select one kpi on that it showing total 151 sites.but make and non make showing wrong value.make is 80 and non make is 71 sites.

pradosh_thakur
Honored Contributor II

Re: expression for nonmake site if select on kpi?

You have to check your logic for that .

In first expresion you have calculated Count(distinct [SCML Id]) , in second you are doing count(distinct Id) not sure if this is what you want.

Please check your fields again.

Learning never stops.
Vince_CH
Contributor II

Re: expression for nonmake site if select on kpi?

Hello Daisy, the result may relate with many contexts. What Pradosh spoke is also a good direction to check. If possible you may share your qvf file in a simple version for check?