Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming Aug. 9: New Simplified Authoring for Qlik Sense SaaS – For Details, CLICK HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis, Avoiding all selections except one

Hi everyone,

I need to calculate the mesoure below:

=count( DISTINCT{<Estado={'Desactivado'}>} [ID Recurso] )/count( DISTINCT [ID Recurso] )

My problem is that I need to ignore ALL the selections except one(for example, Field_1).  I have many fields that can be selected and I cant set each one.

Is there anything i can do to avoid all the selections but the Field_1?

Appreciate your help!

Thanks,

1 Solution

Accepted Solutions
tresesco
MVP
MVP

I would prefer a simpler one (until someone points out a glitch).

=Count( {1<Field_1=$::Field_1>} YourField)

Credit : bwisenoSimenKG

And please be careful,

=Count( {1<Field_1=p(Field_1)>} YourField)  , might give you wrong result, because the possible values of Field_1 are still getting affected by other selections, which you don't want.



View solution in original post

8 Replies
sunny_talwar

Try this:

=Count( DISTINCT{1<Estado={'Desactivado'}, Field_1 = p(Field1)>} [ID Recurso] )/count( DISTINCT {1<Field_1 = p(Field1)>} [ID Recurso] )

maxgro
MVP
MVP

there is a good doc about your question here

Ignore all selections except some specific fields using Set Analysis

Not applicable
Author

Expression given by Sunny T works. but there is one caveat here, if you have a selection on Field_2 which is associated to Field_1 and only 3 (just example) of them are available for the selection, Field_1 =p(Field_1) while have only 3 possible values for Field_1. If you wanted to ignore all selections except Field_1 you will have to ignore all other  fields in the possible set of field_1. like below

Field_1 = p({<all fields except Field_1>}Field_1)

to get the all fields except Field_1 :

in the variable definitions window

vField_1Exclusions = Concat(Distinct '['& if(Not WildMatch([$Field],'Field_1'),[$Field]&']',','))

Field_1 = p({<$(vField_1Exclusions)>}Field_1)

Not applicable
Author

Thanks for your help!

I tried it and it worked!

tresesco
MVP
MVP

I would prefer a simpler one (until someone points out a glitch).

=Count( {1<Field_1=$::Field_1>} YourField)

Credit : bwisenoSimenKG

And please be careful,

=Count( {1<Field_1=p(Field_1)>} YourField)  , might give you wrong result, because the possible values of Field_1 are still getting affected by other selections, which you don't want.



sunny_talwar

tresesco‌ so you are saying that if we have this -> {1<Field_1 = p(Field_1)>} it can change with selection in Field_2 if they are somehow linked together?

I was under the impression that it won't, would you be able to share a sample where it doesn't work.

Thanks,

Sunny

sunny_talwar

Wow you are right, I have using this p thing for a while without knowing this thing. Thanks tresesco‌ for bringing this to my notice. Really appreciate.

Please find attached a sample where other might be able to see an example.

Best,

Sunny

tresesco
MVP
MVP

I thought that this would be better if I could make a document for the same and just did that here: 

Ignore-all-selections-except-few-fields-using-Set-Analysis