Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Strange Behaviour in Set Analysis (Bug?)

Hello,

I have faced a weird behaviour in a set analysis expresion. To show you this I have prepared a simple QV doc with two tables, Company and Country. In the text box I want to show the number of companies that are related to certain countries, and the table shows the list of countries and the number of companies related.

When I do this with a simple set analysis like: {<CountryName={'Country_B'}>} it works fine.

The problem is when I try to do an Intersection between two sets: {<CountryName={'Country_B'}>*<CountryName={'Country_A'}>}. The number shown in the text box is right but the table data shows no values. When I try with Minus '-' the text box number is ok, but again the table shows wrong data.

  Any clue on this?

Thanks in advance,

Javier

5 Replies
Anonymous
Not applicable
Author

Hello,

your expression is correct, in fact you see the correct output in text.

It doesn't work in table because of the dimension: if you use the set analysis with intersection *, the result of the count will be 1 for Company A (it is in both countries) but which value of the dimension have the table to display? It can not decide between Country A or B.

Anonymous
Not applicable
Author

I get the point. How can I do to show at least one? for example, the one with the lower idCountry?

Thnks

Clever_Anjos
Employee
Employee

Maybe =count(TOTAL $(vSetAnalysis) distinct idCompany) return what you need

Anonymous
Not applicable
Author

Hello, Here is the complete especifications for this QV Document.

As you can see in the attached QV file, all operations type works as expected except intersection.

The objective is to count the number of distinct companies in the dimension where the Sales is higher, it does it well except when I use '*' as the operator.

Hope it is more clear now.

ps: I have uploaded the right version.


Regards

kuba_michalik
Partner - Specialist
Partner - Specialist

There is definitely something off here. If you modify the script slightly so that the CompanyCountry table loads first (which really shouldn't be changing the final outcome!), the result in the text box will be 0 as well.

Which, to me at least, makes a lot more sense than the original behavior - set of records for which country is Country_A is separate from the set of records for which country is Country_B (because you can't have two different field values at once for a single field of a single record), and so the intersection must be always empty.