Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
newhere2014
Contributor II
Contributor II

aggr() issue

I want to use aggr() function to get total once for each key. The total is correct for each key, but they are not in the right position in a pivot table

I attached a test qvw.
Could anyone help with that? thanks.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Add the nodistinct qualifier to the aggr function. See attached example.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Anonymous
Not applicable

Looks like this one works:

sum(

if(date2=aggr(min(date2),key, date1),aggr((sum(amount)),key))

)

abeyphilip
Creator II
Creator II

Hi,

It was getting sorted using date.

Changed the sort priority to be sorted using Key and then your 2nd expression value.

See if it helps.

Regards,

Abey

newhere2014
Contributor II
Contributor II
Author

Hi Michael,

    Thanks for reply. It works in the test app. But when I use the formula in my real app, it fails. I attached my real app. Please take a look. Many thanks.

Gysbert_Wassenaar

Add the nodistinct qualifier to the aggr function. See attached example.


talk is cheap, supply exceeds demand
newhere2014
Contributor II
Contributor II
Author

Thanks G and all of you.

Problem solved.