# New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Honored Contributor II

## Peak Sold Sorting not working?

Hi All,

I have below kind of pivot table report. here we have calculated ranking dimension called "Peak Sales Rank" which is based on Singapore Peak Sales it should but i've used below Cal.dimension and below highlighted values shows wrong (Singapore max peak sold value to be in the top and smallest values in the bottom). is there any issue with below expression? kind advise me. thanks

Calculated dimension: Peak Sales Rank

=aggr(Rank(Sum(Aggr(max({<Year={"*"},Week= {"*"},Country={'SINGAPORE'},ArticleNo>}

aggr(sum({<Year={"*"},Week= {"*"},Country={'SINGAPORE'},ArticleNo>}SoldQty),Year,Week,ArticleNo)),ArticleNo)))

,Launch_No,ThemeGroup,ArticleNo)

Peak Sold Measure:

if(Dimensionality() = 5, Max({<Year={"*"},Week= {"*"},ArticleNo>}Aggr(sum({<Year,Week,ArticleNo>}SoldQty),ArticleNo, Week,Year)),

max({<Year={"*"},Week= {"*"},ArticleNo>}

aggr(sum({<Year={"*"},Week= {"*"},ArticleNo>}SoldQty),Year,Week,Country,ArticleNo)))

Tags (1)
5 Replies

## Re: pivot table custom column value sort

Can you try to use "Initial Order" formula in Sort by expression and apply Descending option then check?

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Honored Contributor II

## Re: pivot table custom column value sort

Hi Anil,

Thanks, user request based on the Peak Sold Qty - Singapore column only.

refer to the attached mock report. Thanks

Regards.

Deva

## Re: pivot table custom column value sort

Not sure, Looks like sorting is good to me. Let me know if you want to remove this Image on wall ..

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Honored Contributor II

## Re: pivot table custom column value sort

Hi Anil,

Nope, can you refer to the attached expected excel out. its The report rank by Singapore peak Sold Qty

## Re: pivot table custom column value sort

You can achieve using If(Match(Country, 'SINGAPORE'), Here Formula for Peak Sold) under sort expression..

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)