Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
daisy1438
Contributor III
Contributor III

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
Creator III
Creator III

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
Master II
Master II

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
Contributor III
Contributor III
Author

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
Master II
Master II

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
Creator III
Creator III

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?