Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Rank Aggr issue (Top impact)

 

Hi,

 

I'm in need of some help. I have a Straight table that shows Gross Margin impact this year compared to last in percent by product area. The Expression is a sum aggr on one dimension. My problem is that I want to show the top 3 Impact based on if the negative Impact is the biggest then I want the top 3 negative Impact to be shown and if the positive is the biggest I want the 3 top positive to show. Needs to be dynamical, the result can be different on different weeks. I tried the Rank function but haven’t got it to work. I past some example, How the table could look and what I want it to show.

 

Regards,

Ellinor

3 Replies
Anil_Babu_Samineni

Perhaps this?

Sum({<[Product Area] = {"=Rank(Sum(Impact)) <= 3)"}, Week = {'$(=Max(Week))'}>} Impact)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

My problem is that I want to show the top 3 Impact based on if the negative Impact is the biggest then I want the top 3 negative Impact to be shown and if the positive is the biggest I want the 3 top positive to show.

Based on the data you have provided, can you explain what do you mean by biggest negative and biggest positive impact here?

sunny_talwar

Here are two expressions based on my understanding of your requirement.... These will work when a week is selected

1) =If(Rank(Only(TOTAL Aggr(If(Rank(fabs(Impact)) = 1, Sign(Impact)), ProductArea))*Impact) < 4, Impact)

2) Only({<ProductArea = {"=Rank(Only(TOTAL Aggr(If(Rank(fabs(Impact)) = 1, Sign(Impact)), ProductArea))*Impact) < 4"}>}Impact)