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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

getselectedcount() from another state

I need to reference the selections on a field from a specific alternate state.

I can do this when a function allows set analysis, but it doesn't seem to work on a function like getselectedcount() that doesn't have a set analysis option.

Is there a way around this?

i.e.

=MaxString({[PerfTRAC-Periods]}PerfReturnPeriods_Desc)

     returns the max from the state 'PerfTRAC-Periods'

attempting the same below doesn't work

=GetSelectedCount({[PerfTRAC-Periods]}PerfReturnPeriods_Desc)

Labels (1)
1 Solution

Accepted Solutions
Clever_Anjos
Support
Support

A GetSelectedCount could be translate into:

count(distinct {[PerfTRAC-Periods]} PerfReturnPeriods_Desc)

View solution in original post

6 Replies
simondachstr
Specialist III
Specialist III

How about

=GetSelectedCount(Only({[PerfTRAC-Periods]} PerfReturnPeriods_Desc))

Not applicable
Author

That doesn't seem to work; however, if i take out the getselectedcount(), it will return a value if 1 selected, else null.

That's what i'm testing for in the getselectedcount() so my follow-up question would be, can i easily test that for null?

something like:

=if(only({[PerfTRAC-Periods]}PerfReturnPeriods_Desc)=Null(),

  'MTD',

  only({[PerfTRAC-Periods]}PerfReturnPeriods_Desc))

this doesn't seem to work, but how could i test that the only function returned nothing?

Clever_Anjos
Support
Support

A GetSelectedCount could be translate into:

count(distinct {[PerfTRAC-Periods]} PerfReturnPeriods_Desc)

Anonymous
Not applicable
Author

Mark

When you have got the getselectedcount() for your required Alternate State what are you going to do with the output ?

I ask that as you may be able to define the Alternate State outside the expression.  I.e. if you want to display the output number in a Text Box then could you set this object's State to the Alternate.

Best Regards,     Bill

Not applicable
Author

I'm using it in a function for the title of a chart, so unfortunately I can't just set the state of the object.  I always seem to find the most difficult problems

azimabadi
Creator III
Creator III

Hi,

count(distinct {[PerfTRAC-Periods]} PerfReturnPeriods_Desc)


this is not correct, becuse when you have no selection on field, you will get the distinct count of field values ( for example 10 ) from count function. At the same time you will get the 0 from GetSelectedCount function that correct is.

Best regards

Peyman