Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

robbiewottie
New Contributor III

Count of Current Selections

HI Guys,

I need a function that counts all selections of de current selection box;

Example

Year : 2016

DIM 1 : X

DIM 2: Y

DIM 3: Z

Count  = 4 selections

Any idea's?

Best regards,

Robbie

1 Solution

Accepted Solutions
MVP
MVP

Re: Count of Current Selections

Or, something like:

For number of fields:

SubStringCount( GetCurrentSelections(':', ',', '@', 100), ':')+1

For number of values:

=SubStringCount( GetCurrentSelections(',', ',','@', 100), ',')-SubStringCount( GetCurrentSelections(':', ',','@', 100), ':')


sillytricksdepartment


7 Replies
MVP & Luminary
MVP & Luminary

Re: Count of Current Selections

Try this

=rangesum($(=concat( 'GetSelectedCount([' & FieldValue('$Field', ValueLoop(1, $(=FieldValueCount('$Field')))) & '])',',')))

sillytricksdepartment‌


talk is cheap, supply exceeds demand
balrajahlawat
Esteemed Contributor

Re: Count of Current Selections

something like this?

Chart with count of $Field values

MVP
MVP

Re: Count of Current Selections

Or, something like:

For number of fields:

SubStringCount( GetCurrentSelections(':', ',', '@', 100), ':')+1

For number of values:

=SubStringCount( GetCurrentSelections(',', ',','@', 100), ',')-SubStringCount( GetCurrentSelections(':', ',','@', 100), ':')


sillytricksdepartment


robbiewottie
New Contributor III

Re: Count of Current Selections

Hi Gysbert,

Thanks for your reply but I think my question was not clear enough.

It's not the count of the values of the fields, Its the count of the selections: Year+DIM1+DIM2+DIM3 makes 4...

MVP & Luminary
MVP & Luminary

Re: Count of Current Selections

That's a lot saner than my attempt. You may want to add the Maxvalues parameter though. The default is six. If you have more than six selections in a field the total count will be off.


talk is cheap, supply exceeds demand
MVP
MVP

Re: Count of Current Selections

Absolutely! Important catch.

robbiewottie
New Contributor III

Re: Count of Current Selections

Yes, that did the trick thanks