Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

GetSelectedCount and alternative state

Hi!

Can I use "GetSelectedCount" with alternative state?

I am trying to create a conditional for my expression: sum({[Simulation State]}if([Project type] ='Back up project', Hours)) so that it would do the calculation only if there is at least one value selected in a field "Back up projects".

When I try if(GetSelectedCount( {[Simulation State]} [Back up projects])<>0, ....) it shows error line for the Alt State first curly bracket.. Is it a syntax problem? If I add only() between getselectedcount and alt state it says expression OK but it doesn't make it work as I want.

Thank you community already advanced!

Regards,

Heidi

1 Solution

Accepted Solutions
MVP
MVP

Re: GetSelectedCount and alternative state

=GetSelectedCount( [Back up projects], False(), 'Simulation State')

8 Replies
MVP
MVP

Re: GetSelectedCount and alternative state

MVP
MVP

Re: GetSelectedCount and alternative state

state is the 3rd parameter, field the 1st

this is from Qlik help

getselectedcount (FieldName [, IncludeExcluded [, State]])

Returns the current number of selected values in a field. It is possible to query an alternate state.

If IncludeExcluded is true the count will include selected values, which are currently excluded by selections in other fields. If false or omitted these values will not be included.

State is the alternate state to query.

Examples

getselectedcount ( Year )

getselectedcount ( Year, true( ) )

MVP
MVP

Re: GetSelectedCount and alternative state

=GetSelectedCount( [Back up projects], False(), 'Simulation State')

Highlighted
Not applicable

Re: GetSelectedCount and alternative state

It shows an error after the false and without the false() it doesn't work either?

AltStateError.PNG

MVP
MVP

Re: GetSelectedCount and alternative state

If you are using a version older than 11.2 SR8, the above won't work. This is because it got introduced in SR 8.

HTH

Best,

Sunny

MVP
MVP

Re: GetSelectedCount and alternative state

Link for SR8 Beta Release which talks about this new added functionality in SR8: QlikView 11.20 Service Release 8 Beta is now available

Not applicable

Re: GetSelectedCount and alternative state

Hi!

Thank you Sunny and swuehl! I updated to the SR12 version and now everything works as they should (:

Regards,

Heidi

MVP
MVP

Re: GetSelectedCount and alternative state

Awesome

I am glad we were able to help.

Best,

Sunny

Community Browser