Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tomovangel
Partner - Specialist
Partner - Specialist

Aggr to get max value

Hello guys, I have a StoreID,StoreType and NetAmount columns.

I want to show the max NetAmount in a single storeID, from a single type( StoreType = S,M,L)

I tried

=max(aggr(Sum(NetAmount),StoreType = 'M',StoreID)) & chr(13) & StoreID

And it returns only a value, not the StoreID, this value belongs to.

I also tried

=FirstSortedValue(StoreID , - aggr(sum(NetAmount),StoreType = 'L')) & chr(13) & aggr(sum(NetAmount),StoreType = 'L')
But it doesn't return anything.

Any suggestions will be highly appreciated,

Thanks

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Then, Try this? If not, Remove - and check before Aggr()..

FirstSortedValue(StoreID, -Aggr(Sum({<singletype = {'S','M','L'}>} NetAmount), StoreID)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

8 Replies
Anil_Babu_Samineni

What are you getting when you use this?

Max({<singletype = {'S','M','L'}>} Aggr(NetAmount, StoreID))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tomovangel
Partner - Specialist
Partner - Specialist
Author

I am getting the maximum value for the selected period,
But I am not getting which store, is with that value

patroser
Partner - Creator
Partner - Creator

Hi,

I'm not quite sure if I understood what the expected output would be.
Could you provide the sample output which is on your mind?

Anil_Babu_Samineni

Then, Try this? If not, Remove - and check before Aggr()..

FirstSortedValue(StoreID, -Aggr(Sum({<singletype = {'S','M','L'}>} NetAmount), StoreID)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tomovangel
Partner - Specialist
Partner - Specialist
Author

283092 - 1014
max( NetAmount ) - ( Store ID )  ( of type L)

48 293 - 1001
max(NetAmount)- ( StoreID) ( of type S)

tomovangel
Partner - Specialist
Partner - Specialist
Author

This is returning the StoreID with the max value, from the chosen StoreType

I will test it for a sec, and will mark your answer correct if it works

tomovangel
Partner - Specialist
Partner - Specialist
Author

It works when i make 2 textboxes
1 is with your expression and it gives me StoreID
2 is with =Max({<singletype = {'S','M','L'}>} Aggr(NetAmount, StoreID)) ( and it gives me the NetAmount)

Thanks

Anil_Babu_Samineni

Awesome

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful