4 Replies Latest reply: Oct 7, 2011 12:25 AM by dmitry

Can't understand a behavior of set expression

Hi,

I got the following data set:

NAMEVERSION
AAA1
BBB2
BBB3

and use set analysis to a get maximum version of the records grouped by NAME with a current selection in account

Max({\$<VERSION={'=Aggr(Max(VERSION), NAME)'}>} VERSION)

I expect the following:

NAME-
AAA1
BBB3

but have

NAME-
AAA1
BBB2

so it seems that inner aggregation doesn't work as I expect and instead returs the first value from the group (changin' the enclosed function to Min, Sum or whatever doesn't change the result).

Anybody see a wick point in the approach?

Thanks and regards,

Dmitry

• Can't understand a behavior of set expression

hi,

if you use this:

Max({\$<VERSION={'=Aggr(NODISTINCT  Max(VERSION), NAME)'}>} VERSION)

it works.

C u,

Stefano

• Can't understand a behavior of set expression

Thanks a lot, it works!

But I have to extend my question:

If we have a third column QTY and try to calculate the sum using

=Sum({\$<VERSION={'=Aggr(NODISTINCT Max(VERSION), NAME)'}>} QTY)

it will return the whole sum by AAA and BBB (e.g 10 of AAA + 20 of BBB VERSION 2 + 30 of BBB VERSION 3 = 60) and not the 40 (10 of AAA + 30 of BBB VERSION 3) as it would be expected. Thats the point I completely messed with.

Thanks and regards,

Dmitry

• Re: Can't understand a behavior of set expression

hI,

look at this example.

C u,

Stefano.

• Re: Can't understand a behavior of set expression

Thank you very much! This exactly what I've been looking for and this approach works perfectly! Excelent.