# New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
Honored Contributor II

## Total Peak sold?

Hi All,

Can you advise me on below issue,

Used below set analysis in expression

=Sum(Aggr(max({<Week_No=,Week_No,Batch,ArticleNo>}

aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,Batch,ArticleNo)),ArticleNo,Batch))

FYI, refer the expected output screen image

Tks, Dev

Tags (3)
1 Solution

Accepted Solutions
MVP

## Re: Total Peak sold?

Try this:

=If(Dimensionality() = 0, Max(Aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,ArticleNo)),

max({<Week_No=,Week_No,Batch,ArticleNo>}

aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,Batch,ArticleNo)))

7 Replies
MVP

## Re: Total Peak sold?

Try this:

=If(Dimensionality() = 0, Max(Aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,ArticleNo)),

max({<Week_No=,Week_No,Batch,ArticleNo>}

aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,Batch,ArticleNo)))

Honored Contributor II

## Re: Total Peak sold?

Hi Sunny,

Thank you so much

MVP

## Re: Total Peak sold?

No problem

Honored Contributor II

## Re: Total Peak sold?

Hi Sunny,

Above solution is working fine, but if we add week filter then it's not giving right total. kindly advise. Thanks

=If(Dimensionality() = 0, Max(Aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,ArticleNo)),

max({<Week_No=,Week_No,Batch,ArticleNo>}

aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,Batch,ArticleNo)))

MVP

## Re: Total Peak sold?

Try this:

=If(Dimensionality() = 0, Max({<Week_No=,Week_No,ArticleNo>}Aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,ArticleNo)),

max({<Week_No=,Week_No,Batch,ArticleNo>}

aggr(sum({<Week_No=,Week_No,ArticleNo>}Sold_Qty),Week_No,Batch,ArticleNo)))

Honored Contributor II

## Re: Total Peak sold?

Hi Sunny,

PFA, If we change to other week number from the filter then Peak sold value & Total not changing. is it possible to get the Peak sold value & total based on dynamic week selection from filter. kindly advise. Thank you

MVP

## Re: Total Peak sold?

Here you go:

=If(Dimensionality() = 0, Max({<Week_No= {"\$(='<=' & Max(Week_No))"},ArticleNo>}Aggr(sum({<Week_No,ArticleNo>}Sold_Qty),ArticleNo, Week_No)),

max({<Week_No= {"\$(='<=' & Max(Week_No))"},Batch,ArticleNo>}

aggr(sum({<Week_No= {"\$(='<=' & Max(Week_No))"},ArticleNo>}Sold_Qty),Week_No,Batch,ArticleNo)))