# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

New Contributor III

## Aggr in calculated dimension

I have an aggr dimension that works:

aggr(if(rank(\$(vKPI_Global_Score_YTD))=2,[Customer]),[Customer])

It returns the Customer who has the 2nd highest score for the variable.

Now I want a calculated dimension that should work something like:

IF([Customer] = aggr(if(rank(\$(vKPI_Global_Score_YTD))=2,[Customer]),[Customer]) AND Zone = 'ABC', [Customer Zone])

I also tried something like:

aggr(if(Customer=aggr(if(rank(\$(vKPI_Global_Score_YTD))=2,[Customer]),[Customer]) and Zone ='ABC', [Customer Zone], [Customer Zone])

This however isn't working for both.

Any Idea?

Tags (2)
9 Replies
Honored Contributor II

## Re: Aggr in calculated dimension

maybe this:

=Only( {< Customer = {"\$(=rank(\$(vKPI_Global_Score_YTD)))=2"} >} [Customer Zone] )

Esteemed Contributor

## Re: Aggr in calculated dimension

his second condition is missing:

=Only( {< Customer = {"\$(=rank(\$(vKPI_Global_Score_YTD)))=2"},Zone={'ABC'}>} [Customer Zone] )

Valued Contributor

## Re: Aggr in calculated dimension

Hi

may be this

=Only( {< Customer = {"\$(=rank(\$(vKPI_Global_Score_YTD)))=2"},Zone ={'ABC'} >} [Customer Zone] )

or this

aggr(

if(

rank(\$(vKPI_Global_Score_YTD))=2 AND Zone ='ABC' ,[Customer]),[Customer])

Contributor II

## Re: Aggr in calculated dimension

May I know what is the expression stored in "vKPI_Global_Score_YTD".

Contributor II

## Re: Aggr in calculated dimension

aggr(if(rank(\$(vKPI_Global_Score_YTD))=2,[Customer]),[Customer])

New Contributor III

## Re: Aggr in calculated dimension

Only results in a measure, I need it to result in a dimension.

New Contributor III

## Re: Aggr in calculated dimension

It is a very complicated total score within +10 other variable calculations into it. The problem is that we need the score for just two dimensions without filtering. There is also no set analysis extra possible within the total score, so we are looking for a workaround.

Honored Contributor II

## Re: Aggr in calculated dimension

what's the chart object are you using to display the "Customer Zone" calculated dimension ?

New Contributor III

## Re: Aggr in calculated dimension

So I have \$(vKPI_Global_YTD) as a measure to be display in Simple KPI extension. The idea is to limit the score by only a combination of two dimension values Customer and Zone, therefor I concatenate it, because you can only have one dimension in Simple KPI.

aggr(if(rank(\$(vKPI_Global_Score_YTD))=2,[Customer]),[Customer]) as a dimension, gives me the required result, but it also needs to be limited by zone='EUR'...

If I make a regular table with:

Kolom 1

aggr(if(rank(\$(vKPI_Global_Score_YTD))=2,[Customer]),[Customer])

Kolom 2

aggr(if(Zone='EUR',[Zone]),[Zone])

Kolom 3

\$(vKPI_Global_YTD)

I do get the required value in Kolom 3...