Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
harvinder901
Contributor
Contributor

Need to get Top 10 Deals by Revenue

Hi Experts,

I have a sample data which represents Sales of various products for n deals in several months from Jan to July. (See sample sheet attached for reference).

My requirement is that if user selects any month from Jan to July, then top 10 records sorted by Sales value (Desc to Asc) upto the selected month should be displayed to user. For example : If I select Jan, then top 10 records of Jan should be filtered or If I select March, then top 10 records from Jan to March should be filtered.

I have tried using AGGR function with Rank for this but, the issue that I am facing is if any of the filtered result has any record with duplicate deal name in the whole sheet then that record is also getting filtered in the result.

For ex : I have a deal with name Xerox 198 having sales 228.41 in Jan (part of top 10 for Jan) and same deal name having sales 196.85 (not in top 10). My result of top 10 should include deal with Sales value of 228.41 but in actual row of Sales value 196.85 is also getting included in result set due to duplicate deal name value.

Please help me how to get the correct data. Any help would be much appreciated. Thanks in advance.

Labels (1)
4 Replies
Taoufiq_Zarra

Hi,

Does this solution help to answer your request?

on load add the line RecNo() as Id,

Capture.PNG

then pivot table :

dimension 1: Date

dimension 2 : Add calculated dimension and use the script:

 

=aggr(if( rank(sum(Sales),4)<=10,Deals), Id)

 

 

on expression use olso this expression : sum(Sales)

you can get a result like this

Capture.PNG

 

you can olso add ID as a dimension to get

Capture.PNG

Cheers,

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
harvinder901
Contributor
Contributor
Author

Thanks Taoufiq,

One thing I forgot to mention is I have columns coming from different tables .For the sake of ease, I have shared in one excel. But In my data model Deals are coming from one table, Product from other and Date from another.

 

Taoufiq_Zarra

Can you test see what happens if you put the ID in the Deals table?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Brett_Bleess
Former Employee
Former Employee

Here are a couple of Design Blog posts that I think are what you are needing:

https://community.qlik.com/t5/Qlik-Design-Blog/Recipe-for-a-Pareto-Analysis/ba-p/1468497

https://community.qlik.com/t5/Qlik-Design-Blog/Recipe-for-a-Pareto-Analysis-Revisited/ba-p/1473684

Here is the base URL to the Design Blog area for future reference as well, so you can search yourself:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.