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

Is this a bug with the new outer set analysis syntax?

It doesn't seem like this should return a (see screenshot).

{<uppercase *= {'E'}>}({<uppercase *= {'B','C','D'}>}({<uppercase *= {'A'}>}Concat(lowercase)))

Labels (1)
21 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

What version of QlikView?

-Rob

MVW
Contributor III
Contributor III
Author

May 2022 SR2 and also the latest version of Qlikview. (also tried Qlik Sense, same issue). Seems to be affecting all versions where this new functionality was introduced.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Interesting. You have three outer sets in a row. I have not seen this syntax -- multiple outer sets. What would you expect the behavior to be?

-Rob

MVW
Contributor III
Contributor III
Author

Based on the help text section "Inheritance in multiple steps" in the link below, I would expect the expression to return the same result as when expressed using the inner set notation. 

i.e. Concat({<uppercase *= {'E'}>*<uppercase *= {'B','C','D'}>*<uppercase *= {'A'}>}lowercase)

The expected result for a concat aggregation function would be blank since the sets merge to a null set. 

Inner and outer set expressions | QlikView Help

Something is not working correctly when the outer sets (either by themselves or in combination with the current selection) result in a null set. 

marcus_sommer

Your conditions have an AND linking:

concat({<upper *= {'E'}>*<upper *= {'B','C','D'}>*<upper *= {'A'}>}lower)

and uppercase couldn't have multiple values at the same time and therefore it results in null.

MVW
Contributor III
Contributor III
Author

Yes, blank is the correct result. The outer set notation is returning "a", which is the wrong result. 

marcus_sommer

I think the outer set is just ignored because of the conflicting conditions because a set analysis is quite the same as a selection and you wouldn't be able to apply such selections to a list-box. AFAIK there is no logic implemented which checks the condition in any way and if there is anything invalid  in regard to a selection it isn't applied - it won't be set to FALSE or NULL.

A similar example is to specify a not exists field in the set analysis, for example by not considering the case-sensitive field-handling and applying month = {1} instead of Month = {1} respectively revers. No error happens and the result won't be NULL or ZERO else the statement will be ignored.

MVW
Contributor III
Contributor III
Author

I think a set analysis that results in a null set is quite normal, otherwise a COUNT function will never return 0. I don't think it makes sense that one notation (inner set) can handle it and another equivalent notation (outer set) cannot, despite documented to be equivalent. 

My example is rather simplistic and I was making it obvious about the sets having no intersection. However, it is possible to have sets that are not mutually exclusive in its definition but have the problem because the data that is common to all sets are not in the data yet. For example, the following set should be valid because they all have X, but X is not in the data yet. The result still returns "a", which is wrong.

{<uppercase *= {'E','X'}>}({<uppercase *= {'B','C','D','X'}>}({<uppercase *= {'A','X'}>}Concat(lowercase)))

I'm also attaching another example showing how this issue can cause incorrect results in a more real-world situation. The behavior feels like a bug. It would make this functionality very unreliable and dangerous if it isn't a bug.
cwolf
Creator III
Creator III

No, that's not a bug!

Set expressions define a new selection that leads to a new result set for the aggregation. If using inheritance of set expressions, the result set is only determined at the end of the inheritance.

{<uppercase *= {'E'}>}({<uppercase *= {'B','C','D'}>}({<uppercase *= {'A'}>}Concat(lowercase)))

With the first two steps you get an empty set of field values for the selection. That means that all values are possible for the field 'uppercase' in the third step. The result with 'A' is correct.

If you want to have an intersection of result sets you have to use the set operator '*':

{<uppercase *= {'E'}>*<uppercase *= {'B','C','D'}>*<uppercase *= {'A'}>}Concat(lowercase)

this will give you the result you expect.

In principle it doesn't matter whether set expressions are used as outer or inner sets. The purpose of outer set expressions is if you have multiple aggregations with multiple set expressions to pull the same ones outward.

For example the expression for bonus in your 'Simle Examle.qvw' with correct outer sets:

{<Location *={'Canada'}>}
({<Department *= {'Groceries'}>}(ALT(SUM(Sales)/SUM(Cost),1)-1) * 0.6)
+ ({<Department *= {'Pharmacy'}>}(ALT(SUM(Sales)/SUM(Cost),1)-1)*0.4)