Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

List Object- How to count the options selected?

Hi everyone!

I'm here this time because I've a list object of the months of the year & for a calculation (an expression in a table) I need to know how many months were selected of the list mentioned.

I tried to use the name of the field (Month) but it doesn't return me what I'm expecting.

Then, how can I know how many month were selected?? so far, I'm not interested in know wich months.

Thxs in advance!

5 Replies
Not applicable
Author

Hi

Use GetSelectedCount(Month)

Andris

Not applicable
Author

Hi Adris, thxs 4 answer.

I tried, but it returns -

I dont know if is because the field Month its a key field, could that be?

mike_garcia
Luminary Alumni
Luminary Alumni

If you take a look at the example file called [Photo and Music], you'll notice that on the sheet Music there are several list boxes that have the count of selected items.

In this example, the function 'Count' is being used. So you can just write an expression like:

count(Distinct Month)


Now, if no selections are made, this will return the TOTAL number of distint items, when maybe what you want is zero. So, you can use an if statement that determines if something is selected or not:

if(isnull(GetFieldSelections(Month)),0,count(Distinct Month))


Hope this helps.

Mike.

Miguel García
Qlik Expert, Author and Trainer
Not applicable
Author

Hi Mike,

I just did what you recommend me, and Thxs! It works..!

I'd tried count without distinct and descarted the idea!!

Thxs!

aeAndi
Contributor
Contributor

Thanks, GetSelectedCount worked good 🙂