Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sanjujeeboy
Creator
Creator

Top 10 products

Hi

My requirement is to get Top 10 values for Product A based on Sales. So there will be 10 rows only.

2nd requirement is when i select on country,eg US it should show top 10 sales values for US.

can both requirements be written in 1 expression.?

 

ManufacturerCountryBU_OCRSales
Product AUSCategory 190584
Product AUKCategory 688827
Product AUSCategory 254832
Product AUSCategory 449029
Product AUSCategory 242627
Product ADECategory 540113
Product AUSCategory 139711
Product AUSCategory 136775
Product ADECategory 136645
Product AUSCategory 233170
Product ADECategory 332970
Product AUKCategory 132021
Product AUSCategory 230355
Product ADECategory 230100
Product AUKCategory 329917
Product AUSCategory 425930
Product ADECategory 325696
Product AUSCategory 224523
Product AUSCategory 524485
Labels (1)
4 Replies
mahaveerbiraj
Creator II
Creator II

Hi sanju ,

I hope below expression will help you ,

if(GetSelectedCount (Country)>0,sum(Sales),sum( {< Manufacturer={"Product A"}>} Sales))

and  you can sort by sales with desc 

let me know if  you are not clear.

Thanks 

Mahaveer 

sanjujeeboy
Creator
Creator
Author

Hi Mahaveer,

for 1st requirement, when i put this condition,sum( {< Manufacturer={"Product A"}>} Sales)), it shows me more than 10 records. i want to show only top 10 based on sales irresepective of country and category. so my output should be like this:

ManufacturerCountryBU_OCRSales
Product AUSCategory 190584
Product AUKCategory 688827
Product AUSCategory 254832
Product AUSCategory 449029
Product AUSCategory 242627
Product ADECategory 540113
Product AUSCategory 139711
Product AUSCategory 136775
Product ADECategory 136645
Product AUSCategory 233170

 

can you share the formula for achieving this or may be qvf..

sunny_talwar

Try this may be

Sum(Aggr(If(Rank(TOTAL Sum({<Manufacturer = {'Product A'}>}Sales)) < 11, Sum({<Manufacturer = {'Product A'}>}Sales)), Manufacturer, Country, BU_OCR))
mayuringale25
Partner - Creator
Partner - Creator

Hi @sanjujeeboy 

Go to Table properties 

1.Select Dimension

2.Click on Limitation and select Fixed number.

3. Select Top and enter 10 and It will show you Top 10 Product By sales

Thanks and Regards
Mayur Ingale