Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gauthamchilled
Creator
Creator

equivalent for aggr

hi

i am using aggr function in an expression but performance is heavily affected. is there any alternate?

16 Replies
gauthamchilled
Creator
Creator
Author

eg:

variable vtype = (If([Client Type] = 'Client', '[Client ID]','[Customer ID]'))

in the expression, i am using

Aggr(Maxstring($(vtype )),Country)

swuehl
MVP
MVP

Maybe or maybe not. Hard to tell with the information provided.

gauthamchilled
Creator
Creator
Author

hi stefan,

above is the example expression. anyway to simplify it?

gauthamchilled
Creator
Creator
Author

couldnt able to share data..

but calculating revenue of client or customer for the country...

some country the type is client some country type is customer

this page is for global page design, which involves a chart to show revenue for all countries..(So it is a mix of client and customers)

so based on the country it will pull up the type and calculate revenue.

Gautham

swuehl
MVP
MVP

What's the context of your expression? Where are you using it?

How does your data model look like?

The variable is defined with a leading equal sign, so it returns either of the two field names?

gauthamchilled
Creator
Creator
Author

variable is just this (If([Client Type] = 'Client', '[Client ID]','[Customer ID]'))

i have to calculate revenue based on Client type of the country,

for some country Client Type is Client then calculate revenue of all client id of that country

for some country Client Type is not client then calculate revenue of all Customer id of that country

Aggr(Maxstring($(vtype )),Country) will give me client id or customer id for country in the dimension.

sum({<Aggr(Maxstring($(vtype )),Country) >} Revenue)

swuehl
MVP
MVP

Can't see how this should work. Are you using

Aggr(Maxstring($(vtype )),Country)

as calculated dimension in a chart? And why are you aggregating the clients / customers using Maxstring()?

Your expression

sum({<Aggr(Maxstring($(vtype )),Country) >} Revenue)

does not seem to use correct set analysis syntax.

gauthamchilled
Creator
Creator
Author

hi stefan,

attached a small example of how my data looks..

from the example, i want sum of revenue based on Ftype..please help

Gautham

Anil_Babu_Samineni

What is the expected result from that Straight table?

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