Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr and only?

I started with a table like this.

    

Dim 1Dim 2Dim 5Dim 6Expression
AC2015-01-12SSUM(something)
AC2015-02-13T..
AD2015-04-19U
BE2015-01-03V
BE2015-02-12X

The result I wanted was to get the highest date (Dim 5) over Dim 1 and 2.

With an aggregation like this:

=Date(Aggr(DISTINCT max(Dim 5),Dim 1, Dim 2),'YYYY-MM-DD')

..I got something good to start with:

    

Dim 1Dim 2Dim 5Dim 6Expression
AC2015-02-13SSUM(something)
AC2015-02-13T..
AD2015-04-19U
BE2015-02-12V
BE2015-02-12X

Now to my question - how do I filter Dim 6 so I only get the one that 'connects' to the highest date?

As a result as below?

    

Dim 1Dim 2Dim 5Dim 6Expression
AC2015-02-13TSUM(something)
AD2015-04-19U..
BE2015-02-12X
5 Replies
sunny_talwar

May be replace Dim6 with this:

=Aggr(FirstSortedValue(Dim6, -Dim5), Dim1, Dim2, Dim5)

=Aggr(FirstSortedValue([Dim 6], -[Dim 5]), [Dim 1], [Dim 2])

Capture.PNG

sunny_talwar

Or just use this as your expression and leave Dim 5 and Dim 6 as is:

=Aggr(FirstSortedValue(Aggr(Sum(something), [Dim 1], [Dim 2], [Dim 5], [Dim 6]), -[Dim 5]), [Dim 1], [Dim 2])


Capture.PNG

Not applicable
Author

Thank you, that did the trick.

Not applicable
Author

Thank you, but in your example you get the lowest date.

sunny_talwar

Awesome