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

Top 5 Sales in Bar chart

Hi

Can please guide me how i can show top 5 Product bases on 'Maintenance' Sales

eg.

1,985

2,1055,

2,1130

4,1205

5,1272

Attached sample qvw on same.

Thanks

4 Replies
amit_saini
Master III
Master III

Hi,

Try

OR

Syntax:

=rank(sum(Investment),1,1)

OR

=aggr(if(Rank(sum(Investment))<=3,Investment),Investment) (For calculating Top 3)

OR

=if(rank(sum(Investment),1,1)=1,'# 1')

I have a data table which includes the following fields; SystemID, Timestamp.

I want to derive a new field in this table which ranks the Timestamp in ascending grouped by SystemID

I'd like to do this in the script.

  1. e.g.

SystemID, Timestamp,   [Rank]

00001, 01/01/2013 10:00,   1

00001, 01/01/2013 12:00,   2

00001, 01/01/2013 12:30,   3

00002, 01/01/2013 11:00,   1

00002, 01/01/2013 12:12,   2

00003, 01/02/2013 10:30,   1

Syntax:

LOAD

SystemID, Timestamp,

if(SystemID=previous(SystemID),peek('Rank')+1,1) as Rank

FROM ...mysource...

ORDER BY SystemID, Timestamp;

Thanks,

AS

Anil_Babu_Samineni

Like this

Capture.PNG

If you want to show single value like wither H OR I Then use FirstSortedOrder

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
srinivasa1
Creator II
Creator II
Author

Thanks Amit,

I need do top  5 product in in 2nd expression .

in  'Maintenance' Expression

sum({<Type={'Maintenance'}>}Sales)  in this expression  value I need to consider for top 5 product 

 

Thanks

Thanks

srinivasa1
Creator II
Creator II
Author

Thanks All and I have achieved as expected  by writing below expression.


=if(Aggr(rank(sum({<[Type]={'FIiled1',
'FIiled2', FIiled3' }>  Sales)/count(DISTINCT ID)),[ Product
Line]) <=10,
sum({<[Type]={ 'FIiled2',
FIiled3' }>} Sales count(DISTINCT ID))


Thanks Again!.