Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

biob_stein
Contributor

Use Alternate state in expression with aggr

Dear Community,

i have following expression:

SUM(aggr(DISTINCT(AMOUNT),SN,DATE,AMOUNT))

And the alternate state:

X

Now i want to transform this expression so it runs under the alternate state X

I tried :

sum({X} aggr(DISTINCT(AMOUNT),SN,DATE,AMOUNT))

But the aggreagate is not working over this alternate state

Please help!

13 Replies

Re: Use Alternate state in expression with aggr

no , you should mention the dimension in alternate state to act on this count , try like this

sum({X<D1 = $:Smiley Very Happy1,D2 = $:Smiley Very Happy2} aggr(DISTINCT(AMOUNT),SN,DATE,AMOUNT))

here the D1 and D2 are the dimension which are being used in the alternate state

ecolomer
Honored Contributor II

Re: Use Alternate state in expression with aggr

try this

sum(aggr({X} Distinct (AMOUNT), SN,DATE, AMOUNT))

and in the alternate state dont select X

biob_stein
Contributor

Re: Use Alternate state in expression with aggr

Hi Enrique,

With such a syntax i am getting the same result as the initial expression

SUM(aggr(DISTINCT(AMOUNT),SN,DATE,AMOUNT)) so it does not use the alternate state

biob_stein
Contributor

Re: Use Alternate state in expression with aggr

Hi Avinash,

i mentioned now all dimensions :

sum({X<DATE = $:Smiley Very HappyATE,SN = $:Smiley FrustratedN,AMOUNT= $::AMOUNT} aggr(DISTINCT(AMOUNT),SN,DATE,AMOUNT))


but its still not working i am getting all the time the same result as the initial expression:

SUM(aggr(DISTINCT(AMOUNT),SN,DATE,AMOUNT))


When using simple:

sum({X}AMOUNT) its working but i need the aggregate!

sasiparupudi1
Honored Contributor III

Re: Use Alternate state in expression with aggr

Hi

Please post your application here

Sasi

antoniotiman
Honored Contributor III

Re: Use Alternate state in expression with aggr

sum(aggr(DISTINCT  Only({X} AMOUNT),SN,DATE,AMOUNT))

or Sum( instead Only(

Re: Use Alternate state in expression with aggr

hi BioB_Paul,

As per knowledge we cannot specify the aggr function to aggregate on the alternate state dimensions, by default it will on the default state, if you want to aggregate then your chart and the aggregating dimension need to be in same state...no other way yo get it work

sasiparupudi1
Honored Contributor III

Re: Use Alternate state in expression with aggr

biob_stein
Contributor

Re: Use Alternate state in expression with aggr

Still it does not work, and behaves like its not using the alternate state for the aggr.

Tried "only" or "sum" ...

Community Browser