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

AGGR() by All Dimensions in a Table

Hey all,

I want to automatically aggr() by every dimension that is in my table. Is there a way to concat all the dimensions together potentially using Dimensionality() and GetObjectField(). 

For example, if my table had PRODUCT and CUSTOMER as dimensions, the aggr would end up looking like:

aggr(sum(sales),PRODUCT,CUSTOMER)

Thanks,

Tanner

Labels (1)
2 Replies
Digvijay_Singh

AFAIK the measure is automatically calculated against all the dimension in a straight table, trying to understand your need, are you changing your dimensions through some variable or filter? I normally see needs to skip few chart dimensions or utilize aggr to have dimensions other than chart dimensions.

tsglenn22
Contributor III
Contributor III
Author

That was what I thought it should be doing as well. I'll show the example. The aggregation function I'm using is actually an IRR() with an ordered aggr() by months to ensure my cashflows are correctly sorted. I have two dimensions in my straight table for this example. I have 3 different measures.

The first contains the correct answer and aggrs() by the two dimensions in the table + months:

IRR(aggr(sum(NET_CASHFLOWS_EC),CP,SLU_1_ADJ,SLU_2_ADJ,(MONTHS,(NUMERIC,ASCENDING))))*12

The middle measure is what I was hoping would work, it is just an aggr by the sorted months:

IRR(aggr(sum(NET_CASHFLOWS_EC),(MONTHS,(NUMERIC,ASCENDING))))*12

The last measure has nodistinct in it but just repeats the middle calculation for every row:

IRR(aggr(nodistinct sum(NET_CASHFLOWS_EC),(MONTHS,(NUMERIC,ASCENDING))))*12

 

The underlying data is fairly simple. It's a single table in the data model that is distinct on the combination of ID_NUMBER and MONTHS. There are no nulls or any other oddities.