Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
DatinexPeyman
Partner - Contributor II
Partner - Contributor II

Problem with set analysis (outer/inner set expression)

Hi every body,

i have a simple flat table:

LOAD
*
INLINE [
Country,TYPE,Value
Germany,A,55
Germany,B,66
];

I cant't understand, why qlik sense delivers two different values for these expressions:

Sum( {<TYPE={C},Country={Germany}>} Value )
{<TYPE={C}>} Sum( {<Country={Germany}>} Value )

Temp.png

i don't need any work around to salve the problem in this data model! This is just a simplification of the same problem in a very complicated app to describe you my problem.

Is this a BUG?
Is there any way to get the same result "0" from the secound expression?

Thank you in advance for your USEFUL answers!

 

Best regards
Peyman

Labels (1)
6 Replies
QFabian
Specialist III
Specialist III

Hi @DatinexPeyman , reading the help https://help.qlik.com/en-US/sense/November2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAn..., maybe it is about  Inheritance

heritance

Inner set expressions have precedence over outer set expressions. If the inner set expression contains a set identifier, it replaces the context. Otherwise, the context and the set expression will be merged.

  • {$<SetExpression>} - overrides the outer set expression

  • {<SetExpression>} - is merged with the outer set expression

 

QFabian
DatinexPeyman
Partner - Contributor II
Partner - Contributor II
Author

Hi Fabian,
thank you for your answer!

I have read the halp about outer and inner expressions many times. I have used no set identifier, that means the case 2 and it must be merged. But obviusly it's not merged. Merge must be some thing like AND.

Regards
Pey

marcus_sommer

The essential difference between both versions is that the first one has a single set statement and the second one has two set statements.

The two used conditions exclude each other. In the single statement both conditions are linked with AND which lead to zero as result. But this didn't happens by using an outer + inner statement because both statements are executed separately - means the second condition comes after the first one. It's the same as if you would try to select these values directly per list-boxes. Assuming there were a third record with USA as Country and C as TYPE - you would be never able to select C and Germany at the same time - each selection would remove the other selection and if you lock a field you won't be able to select any values against this lock.

In other words - both conditions couldn't be merged because they are excluding each other and so the one with the highest priority wins - which is in default the most inner one. Further concluding - combining inner + outer set statements is surely useful in specific (checked) scenarios but not a good idea for a general approach.

QFabian
Specialist III
Specialist III

thanks for the clare explanation @marcus_sommer 

QFabian
DatinexPeyman
Partner - Contributor II
Partner - Contributor II
Author

Thank you for your answer.

Speaking from two set statements, you must have an operator. There are four operators based on Qlik Help:
https://help.qlik.com/en-US/sense/November2023/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAn...

Under inner and outer set expressions we have:

Inheritance

Inner set expressions have precedence over outer set expressions. If the inner set expression contains a set identifier, it replaces the context. Otherwise, the context and the set expression will be merged.

  • {$<SetExpression>} - overrides the outer set expression

  • {<SetExpression>} - is merged with the outer set expression

I have no set identifier, that must be a MERGE. But what is a MERGE? I dont' know from Qlik help or set theory an operator names MERGE! Is it UNION? Obviusly not, is it INTERSECTION? Not againe.

Unfortunatly your explanation about selecting the fields on interface is not true. just try to remake the app and select the fields, as you described. It is not working as you imagine!

Basically you can not compare sets with interface selections. Bacuse selections dosn't work exactly like set analysis in Qlik Sense.

It's going to be much intersteing. Adding the new data line as you mentioned leads to:

DatinexPeyman_0-1706184610284.png

Now it's working! How do you explain this? If your logic is true, we must get 77.

If you think you have seen all, just wait a moment. Let's try something else:

DatinexPeyman_1-1706185531469.png

As soon as you have an inner set expression, it looks to do every thing it wants, else than what you need. What is going on here?! (I know, it's override, but it must be vice versa, outer one must override inner one, thinking logically)

The idea of outer & inner expresssions is a brillint one. So you can nest your expresssions ideally. But if it dosn't work, it's better to just exclude it, or fix the problem as soon as posible.

We have developed a pallete of products based on this feature(?!), and now, in special cases, when some values in fields are excluded based on section access, the object deliver ... .

I'm simply loosing my fate on Qlik after 20 years of very good experinces!

 

Regards
Peyman

 

DatinexPeyman
Partner - Contributor II
Partner - Contributor II
Author

Hi fabian,
what is exactly CLEAR to you? Can you please help me to be clarified like you? Becuse as more that i experiment with inner and outer expressions, my confustion get's bigger!
It's very important for me to understand how combination of inner and outer expressions works. We have developed hunderds of expression based on this feature.

Or you are only commenting to gather points and i must forget about yout help to solve my problem?

Regards
Peyman