Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
truppell
Not applicable

Set Analysis with selection not working as expected

Hello,

I am trying to understand set analysis, but it doesn't seem to work as I expect when I make a selection. Here is my data:

Residences:

LOAD * INLINE [

Residence_ID, address, type

1, 123 Main St, Apartment

2, 234 Bay St, House

3, 345 Second St, Apartment

4, 456 Oak St, House

];

People:

LOAD * INLINE [

Name, gender, Residence_ID

JOHN SMITH, M, 4

ROBERT JOHNSON, M, 3

MICHAEL MILLER, M, 1

WILLIAM BROWN, M, 4

DAVID JONES, M, 1

RICHARD WILLIAMS, M,2

MARY DAVIS, F, 3

PATRICIA ANDERSON, F, 2

LINDA WILSON, F, 4

BARBARA MARTIN, F, 3

ELIZABETH TAYLOR, F,1

JENNIFER MOORE, F, 3

];

Then I create a bar chart with dimension of gender and measure of count({$<type={'Apartment'}>} Name)

So I only want my chart to count the number of people living in apartments.

If I then select to just show item of type House, I expected my chart to be blank, because $ represents the current selection and there is nothing of type "Apartment" in that selection; however, it does not change.

Can someone explain this?

Thanks,

Tanya

Tags (1)
1 Solution

Accepted Solutions
sunny_talwar
Not applicable

Re: Set Analysis with selection not working as expected

I think you need this:

Count({$<type * = {'Apartment'}>} Name)


Implicit Set Operators

5 Replies
andrespa
Not applicable

Re: Set Analysis with selection not working as expected

Hi Tanya, actually is quite the opposite, you're forcing that no matter the selection, you will always have the number of people living in apartments.

Cheers,

Andrés

antoniotiman
Not applicable

Re: Set Analysis with selection not working as expected

Hi Tanya,

try

count({$<type-={'House'}>} Name)

gferran
Not applicable

Re: Set Analysis with selection not working as expected

Tanya,

in the set analysis you are using:

- $: to respect the current selections

- type={'Apartment'}: the bar chart always show the type apartment despite you select another type

For mor information about set analysis: https://community.qlik.com/docs/DOC-4951

Regards

sunny_talwar
Not applicable

Re: Set Analysis with selection not working as expected

I think you need this:

Count({$<type * = {'Apartment'}>} Name)


Implicit Set Operators

truppell
Not applicable

Re: Set Analysis with selection not working as expected

I wish I could select multiple responses as correct. Andres, yours explained the behaviour I was seeing and Sunny T explained how to get the behaviour I was expecting!

Thanks everyone!