Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

g_f_bakker
New Contributor

Variable in Aggr formula

Hello community members,

I have a problem with a variable in my aggregation formula:

=Sum(If(Aggr(NODISTINCT Max(DEVEMPDATEKEY,240),SUBDEVICE_ID='2')<=DEVEMPDATEKEY,1,0) * AMOUNT)

I want a substitute for the part SUBDEVICE_ID='2' into a variable:  {<SUBDEVICE_ID={"$(vDevIdStation1)"}>}

Please help me with the syntax.

Many thanks, Gerard.

Tags (2)
1 Solution

Accepted Solutions

Re: Variable in Aggr formula

Try

=Sum(If(Aggr(NODISTINCT Max({<STATION={"$(='0'&vStation1)"}>}DEPSTATDATENR,60),STATION)<=DEPSTATDATENR,1,0) * QTYPC)

Because your variable doesn't contain the value 02, but 2 it's necessary to add the 0 in the set modifier.


talk is cheap, supply exceeds demand
4 Replies

Re: Variable in Aggr formula

Can you please elaborate your expression ?

g_f_bakker
New Contributor

Re: Re: Variable in Aggr formula

Hi Manish,

See attached file. The station is now a fixed number in the aggr function and I like to work with a variable.

The expression is about the last 60 and 240 records of a aggregated sorting per station.

Many thanks for your answer.

Gerard.

Re: Variable in Aggr formula

Try

=Sum(If(Aggr(NODISTINCT Max({<STATION={"$(='0'&vStation1)"}>}DEPSTATDATENR,60),STATION)<=DEPSTATDATENR,1,0) * QTYPC)

Because your variable doesn't contain the value 02, but 2 it's necessary to add the 0 in the set modifier.


talk is cheap, supply exceeds demand
g_f_bakker
New Contributor

Re: Variable in Aggr formula

Hi Gysbert,

That’s brilliant!!

The 2 and 02 was my error, the former result set was without the 0.

It’s working perfectly now!

Many thanks, Gerard. (oftewel: SUPER bedankt man!!)

Community Browser