Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
Customers, Partners & Luminaries only: You're invited to a Data Analytics Roadmap session. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Partner
Partner

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.

1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

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

View solution in original post

4 Replies
Highlighted
MVP
MVP

Can you please elaborate your expression ?

Highlighted
Partner
Partner

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.

Highlighted
MVP & Luminary
MVP & Luminary

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

View solution in original post

Highlighted
Partner
Partner

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!!)