Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
kamal_sanguri
Specialist
Specialist

Aggregate function in Set Analysis with and without $ Expansion

Hi,

I was trying using Min/Max aggregate function in Set Analysis. I used function in different way and got different result.

                                                                   

                                                                        LOAD SCRIPT

**********************************************************************************************************************************************

Data:

Load *

Inline

[

Marks, Name

150, A

250, B

120, C

320, D

188, E

235, F

354, G

199, H

297, I

];

NewData:

Load

  Max(Marks) as MaxMarks

Resident Data;

Let MaxMarks = Peek('MaxMarks',0,'NewData');

Drop Table NewData;

**********************************************************************************************************************************************



Function : =Concat({<Marks={"$(=Min(Marks))"}>}Name,';')


Output: C


Function : =Concat({<Marks={"=Min(Marks)"}>}Name,';')


Output: A;B;C;D;E;F;G;H;I


It seems, in second case.. it is going row by row but I think, it should not be the case when use set..


Please share your thoughts..!!


Thanks,

-Kamal

10 Replies
rubenmarin

At first sight it seems that set analysis isn't working in your second function, so it returns the values it will return removing the set analysis. Can you try it?

sunny_talwar

I think your second expression's set analysis is not working at all. Without Dollar sign expansion of the Min() function, it is not getting evaluated to any value. That is why you are seeing all the values from your Name field. Where as the first one is evaluating the Min() function and only showing Marks where it equals Min(Marks)

Colin-Albert

Create straight table chart with Name as a dimension and your two expressions and you can see what is happening.

ConcatSet.JPG

sunny_talwar

Actually, at another look, it is working, but it is working like a search string on Marks field. And you are right search strings kind of work line by line on the field they are getting evaluated on.

swuehl
MVP
MVP

The second expression is working as designed.

The advanced search is creating a hyper cube with marks as dimension and

=Min(Marks)

as expression, which essentially return the dimensional value, a number, which then would be interpreted as TRUE.

All true dimensional values will be included in the set.

marcus_sommer

The reason is that the $-sign expansion $(=Min(Marks)) worked like a variable and which will be calculated once and at first on a global level before the chart is calculated. This meant you couldn't use a $-sign expansion if you need the expression to be calculated on row-level.


- Marcus

rubenmarin

Thanks for explanation swuehl, I couldn't guess why is returning all the values

kamal_sanguri
Specialist
Specialist
Author

Thanks much to all of you for your suggestions..

So,does that mean.. we should use $ sign expansion while using a function in set.. otherwise we may get unwanted results..?

Thanks,

-Kamal

marcus_sommer

This couldn't be answered in general - it will be always depend on the datamodel and which views with which conditions should be displayed. But if you knows that there are differences between various syntaxes you could it change fast from one to another when the results aren't like expected.

- Marcus