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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
kkkumar82
Specialist III
Specialist III

Top N Analysis issue

All,

Attaching a qvw file where I want to have two things

1.  One in a text box

2. Another in a pivot table.

Ist requirement:

Want to see top 5 salesman along with their sales

I was able to get top 5 Salesman but not their sales

2nd requirement

Have a pivot table ProductID, SalesmanID

In the pivot table I am showing top 5 SalesmanID for each productID(got this)

also want to show the top Performers in a productID along with his sales in the pivot table

Kiran Kumar

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

2) Two expression for your 2nd requirement

Top Performer - > FirstSortedValue(TOTAL <[Product ID]> Salesman, -Aggr(Sum(Sales),[Product ID],[Salesman ID]))

Top Performer's Sales -> Max(TOTAL <[Product ID]> Aggr(Sum(Sales), [Product ID], [Salesman ID]))

Capture.PNG

View solution in original post

6 Replies
Chanty4u
MVP
MVP

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this using variable

Regards,

jagan.

kkkumar82
Specialist III
Specialist III
Author

Hi Jagan,

Sorry I didn't find the solutions , did I miss anything.

Attaching some pics for further clarity.

Text Box1.png

I was able to get the above text box but was not able to get the Sales of the persons after them for a selected product.

Top Performers.png

In the above for Top Performer I want Charles ... name becuase he is the top sales and in the next column the sales of Charles..

Hope I am clear this time.

Thanks

Kiran Kumar

sunny_talwar
MVP
MVP

1) Expression for 1st requirement

=If(GetSelectedCount([Product ID]) = 0, 'Select a ProductID', Concat(Distinct If(Aggr(Rank(Sum(Sales)), [Product ID],[Salesman ID]) <=5, [Salesman ID] & '-' & Aggr(Sum(Sales), [Product ID], [Salesman ID])), Chr(13)))


Capture.PNG

sunny_talwar
MVP
MVP

2) Two expression for your 2nd requirement

Top Performer - > FirstSortedValue(TOTAL <[Product ID]> Salesman, -Aggr(Sum(Sales),[Product ID],[Salesman ID]))

Top Performer's Sales -> Max(TOTAL <[Product ID]> Aggr(Sum(Sales), [Product ID], [Salesman ID]))

Capture.PNG

kkkumar82
Specialist III
Specialist III
Author

Thanks sunny it solved my problem just like that.  regards Kiran Kumar