Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
devarasu07
Master II
Master 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

PeakSold.jpg

Tks, Dev

1 Solution

Accepted Solutions
sunny_talwar

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)))

View solution in original post

7 Replies
sunny_talwar

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)))

devarasu07
Master II
Master II
Author

Hi Sunny,

Thank you so much

sunny_talwar

No problem

devarasu07
Master II
Master II
Author

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)))

PeakSold.png

sunny_talwar

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)))

devarasu07
Master II
Master II
Author

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

sunny_talwar

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)))