Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
is there a difference in a aggregated function, in which order you put the dimensions after the first expression?
LIke:
Avg(Aggr(Sum(Sales), Customer, Region))
or
Avg( Aggr(Sum(Sales), Region Customer))
Is there any difference in the outcome?
If yes, what I have to be aware of when using it?
Thanks in advance.
Best.
The data will be grouped like below.
Case1
Customer | Region |
C1 | APAC |
C1 | NAM |
C2 | APAC |
C2 | EMEA |
C3 | NAM |
Case2
Region | Customer |
APAC | C1 |
APAC | C2 |
EMEA | C2 |
NAM | C1 |
NAM | C3 |
So, the result will be different.
This is a good question that I too had in mind at my early days with qlik. You are right, the final output would have no difference if you change the order of dimensions in aggr().
Hi @tresesco ,
exactly!
I just tried the same with number values. Either way I got the same outcome. Since the grouping like shown from @Saravanan_Desingh just put the rows in different order its still just a "virtual table". And that wouldn't make any difference.
Avg(Aggr(Sum(Sales), Customer, Region))
Dim1=Customer, Dim2=Region
Avg( Aggr(Sum(Sales), Region Customer))
Dim1=Region, Dim2=Customer
Yes, the Grouping will be different.
Hello,
can you please elaborate a little more about that.
Yes the Grouping will be different, what exactly?
Thanks in advance.
The data will be grouped like below.
Case1
Customer | Region |
C1 | APAC |
C1 | NAM |
C2 | APAC |
C2 | EMEA |
C3 | NAM |
Case2
Region | Customer |
APAC | C1 |
APAC | C2 |
EMEA | C2 |
NAM | C1 |
NAM | C3 |
So, the result will be different.
Thank you very much so far.
I only can see difference in sorting
But when its about values, not string, and I want to count, sum something, this wouldn't make any difference at all?
This is a good question that I too had in mind at my early days with qlik. You are right, the final output would have no difference if you change the order of dimensions in aggr().
Hi @tresesco ,
exactly!
I just tried the same with number values. Either way I got the same outcome. Since the grouping like shown from @Saravanan_Desingh just put the rows in different order its still just a "virtual table". And that wouldn't make any difference.