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

Aggregated function order of the dimensions

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.

3 Solutions

Accepted Solutions
Saravanan_Desingh

The data will be grouped like below.

Case1

CustomerRegion
C1APAC
C1NAM
C2APAC
C2EMEA
C3NAM

Case2

RegionCustomer
APACC1
APACC2
EMEAC2
NAMC1
NAMC3

So, the result will be different.

View solution in original post

tresesco
MVP
MVP

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().

View solution in original post

Applicable88
Creator III
Creator III
Author

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. 

View solution in original post

6 Replies
Saravanan_Desingh

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.

Applicable88
Creator III
Creator III
Author

Hello,

can you please elaborate a little more about that. 

Yes the Grouping will be different, what exactly?

Thanks in advance. 

Saravanan_Desingh

The data will be grouped like below.

Case1

CustomerRegion
C1APAC
C1NAM
C2APAC
C2EMEA
C3NAM

Case2

RegionCustomer
APACC1
APACC2
EMEAC2
NAMC1
NAMC3

So, the result will be different.

Applicable88
Creator III
Creator III
Author

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? 

 

tresesco
MVP
MVP

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().

Applicable88
Creator III
Creator III
Author

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.