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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
zjdoonj
Contributor III
Contributor III

Display count of records only if a selection has been applied in any of the filters

Hi Friends,

I have a KPI below which is displaying "Records Returned" and expression I used is  following:

Count(distinct[Project Code])

zjdoonj_1-1636046245291.png

 

My requirement is to display " Records Returned " only if there is any or multiple selections in several filters been applied otherwise KPI should display zero. Filters on the app are "Country cd" , "State cd", "City Cd", "Region Cd" , "Assigned Officer"   etc.  and may be few more going forward.

How can we achieve that?

Thanks,

ZJ

1 Solution

Accepted Solutions
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Yes. Sorry for delay in reply. 🙂

Just put 0 in else part of If.

If( len(trim(GetCurrentSelections()))>0, Count(distinct[Project Code]), 0 )

 

Hope that solves your question.

View solution in original post

10 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hello,

You can use condition like below.

If(GetsSelectedCount(Country cd) + GetsSelectedCount (State cd) +

GetsSelectedCount (City cd) > 0, Count(distinct[Project Code])

)

 

Thanks,

Ashutosh

zjdoonj
Contributor III
Contributor III
Author

Sorry this expression is not working. Is this a qlik sense function? I am using qlik sense.

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Its GetSelectedCount().

Sorry for the typo 

zjdoonj
Contributor III
Contributor III
Author

Yes now it worked but the problem is if I will have 15 more filters then I will need to add all those in the expression like +GetsSelectedCount (Region)  and so on.  We have 15 reports and each report has 25-30 filters on that.

Is there not a way that no matter which filter we apply from the report "Records Returned" gets displayed otherwise shows zero?

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Ok. You can try this 

If( len(trim(GetCurrentSelections()))>0, Count(distinct[Project Code]) )

zjdoonj
Contributor III
Contributor III
Author

Great this works perfect. One last question, with this code when there is no selection it displays like below

zjdoonj_0-1636051016045.png

Can we display 0 instead -  ?

Thank you so much for the help.

zjdoonj
Contributor III
Contributor III
Author

No worries I got that working.

Thank you so much for the help.

AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Yes. Sorry for delay in reply. 🙂

Just put 0 in else part of If.

If( len(trim(GetCurrentSelections()))>0, Count(distinct[Project Code]), 0 )

 

Hope that solves your question.

zjdoonj
Contributor III
Contributor III
Author

Yes. Thank you!