Announcements
cancel
Showing results for
Did you mean:
Master II

## sortable Aggr function issue?

Hi,

I'm trying to achieve Sorting aggr function in my expression and it's not working. can you advise me how to achieve the below expected output. thanks.

=aggr(rangesum(Above(TOTAL (sum(TotalNetPrice)/sum(TOTAL TotalNetPrice)),0,RowNo(Total))),(Article,(= sum(TotalNetPrice)/sum(TOTAL <Article> TotalNetPrice)), Desc))

Note: need to apply sort only in the expression, because report display based on other columns.

Cumulative % sort by Sales% Calculated measure.

tried with below article,

The sortable Aggr function is finally here!

Thanks

Deva

1 Solution

Accepted Solutions
MVP

It just needed a bracket correction:

aggr(rangesum(Above(TOTAL (sum(TotalNetPrice)/sum(TOTAL TotalNetPrice)),0,RowNo(Total))),(Article,(= sum(TotalNetPrice)/sum(TOTAL TotalNetPrice), Desc)))

5 Replies
Specialist II

There is no field called Desc and why are you using  a expression ,(= sum(TotalNetPrice)/sum(TOTAL <Article> TotalNetPrice)), as dimension in aggr function

Master II
Author

Hi,

It's sort criteria (ASC or DESC order), so in my output it should be Desc order

MVP

It just needed a bracket correction:

aggr(rangesum(Above(TOTAL (sum(TotalNetPrice)/sum(TOTAL TotalNetPrice)),0,RowNo(Total))),(Article,(= sum(TotalNetPrice)/sum(TOTAL TotalNetPrice), Desc)))

Partner - Champion III

The Aggr() dimensions must be fields, not expressions. As far as I know, this has not changed with the 'structured parameters' of the sortable Aggr(). From the help:

Syntax:

Aggr({SetExpression}[DISTINCT] [NODISTINCT ] expr, StructuredParameter{,StructuredParameter})

...

A structured parameter is composed of a dimension and optionally of some sort criteria.

The dimension is a single field and cannot be an expression. The dimension is used to determine the array of values the expression should apply to.

Aggr - chart function ‒ Qlik Sense

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Specialist II

sorry my bad I am using Qlikview 11 version which prompted the error . Considering the expression  you have used

below how do you get the  78% ,82% for the article 30270006, 20780203

aggr(rangesum(Above(TOTAL (sum(TotalNetPrice)/sum(TOTAL TotalNetPrice)),0,RowNo(Total))),Article)

Community Browser