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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
srinivas1921
Contributor III
Contributor III

How to display top 3 Contract Names when same contract names are there?

Hi,

one of our requirement is need to display top 3 contract Names based on amount value in the Bar chart.But when I trying to display top 3 contract Names it was showing wrong values due to grouped by Contract Name.

Please see below tables and suggest me solution on this to expected results.

Actual Data:-

Contract NumberContract NameAmount
121AAA100
122BBB50
123AAA62
124CCC55
125DDD80

showing output in the Bar Chart as below:-

Contract NameAmount
AAA162
DDD80
CCC55

Expected Output as below:-

Contract NameAmount
AAA100
DDD80
AAA62
1 Solution

Accepted Solutions
sunny_talwar

Try this script:

Table:

LOAD Dual([Contract Name], AutoNumber([Contract Number]&[Contract Name])) as [Dim Contract Name],

  [Contract Number],

    [Contract Name],

    Amount

FROM

[https://community.qlik.com/thread/233795]

(html, codepage is 1252, embedded labels, table is @1);

Bar Chart

Dimension

[Dim Contract Name]

Expression

=Sum({<[Dim Contract Name] = {"=Rank(Sum(Amount)) < 4"}>}Amount)

Capture.PNG

View solution in original post

14 Replies
martinpohl
Partner - Master
Partner - Master

I think you should Change your Expression from sum(Amount) to max(Amount)

So you will get the Maximum number for each Contract Name.

Than you can Limit the datas to top 3.

Regards

sunny_talwar

Check out the attached

Capture.PNG

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hey there,

Please check out my solution in the attached file:

Best regards,

D.A. MB

sunny_talwar

miguelbraga‌‌ -

But this isn't matching the desired output.

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hey Sunny,

I've noticed that, I'm sorry

Your solution is the right one

Thanks mate

MB

sunny_talwar

Don't have to be sorry my friend. I am pointing it out in a hope that you might come up with another way to do this. I don't like what I have, may be someone else can do better

Best,

Sunny

miguelbraga
Partner - Specialist III
Partner - Specialist III

This should do the work without the aggr function

Best regards

D.A. MB

sunny_talwar

Dimension limits? Sweet

Thanks for sharing miguelbraga‌. But try to give more information as the OP might have to look for what you have done.

Best,

Sunny

miguelbraga
Partner - Specialist III
Partner - Specialist III

Hey srinivas b

I've done a Straight Table with a Dimension Limit based upon a Variable that you can change with the slider chart object to have a more flexible table

Best regards,

D.A. MB