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

Aggregate on Dynamically changing Dimensions

Hi

I am facing issue with aggregating on different dimensions.

Let's say i have 10 dimensions in one list box and i want to aggregate measure on only those dimensions which are selected in Listbox.

Ex : - 1,2,3,4,5,6,7,8,9 are the dimensions and measure is sales i want to aggregate sales on dimensions selected

i selected 2,4,5 dimensions - sum(aggr(sales,2,4,5)) is what i want

Can anyone please help

Thanks in Advance!!

7 Replies
Anil_Babu_Samineni

Please post sample qvw?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MK_QSL
MVP
MVP

What exactly you want to do after creating this expression.

We are using Aggr when you want to use more than one Aggregation in a single expression.

i.e. More than one from Min, Max, Sum, Count, Avg etc

If you simply want to do sum as per your question

sum(aggr(sales,2,4,5))


You can simply use SUM(sales) which will give you same result.

You don't need to use

SUM(Aggr(SUM(Sales),1,2,3,4))

mosha231
Contributor II
Contributor II
Author

I want to aggregate my sales measure on basis of dimension selections or you can say i want to  group by my measure on basis of dimension selection.

MK_QSL
MVP
MVP

But if you are using this expression on any chart / table, then you need only SUM(sales)

Otherwise

SUM(aggr(Sum(sales) ,f1,f2,f3)

will give you same result as

sum(sales)

I still don't understand your use case for this requirement.

mosha231
Contributor II
Contributor II
Author

Hi ,

I am using Sum(aggr(sales,f1,f2,f3)) not Sum(aggr(sum(sales,f1,f2,f3))  to aggregate

MK_QSL
MVP
MVP

Can you provide example or sample data using the above expression?

You are using only once Aggregation and still want Aggr function.

rimantasendriuk
Contributor II
Contributor II

Is this question answred? Or maybe someone can suggest the answer somewhere in other sources?