Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Group by Region wise, need Max Quantity and corresponding name

Hi All,

 
Please help me on the below requirement.
 
i have a table like this.
 

Region
Name
Quantity
aaa

5

abb5
acc3
bdd3
cee2






i want the output like below format... which is that region wise, maximum quantity and the corresponding person who achieved that.

RegionNameQuantity
aaa,bb5
bdd3
cee2


please help in formulating the expression to obtain the Name for the max quantity.



Thanks in advance,

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw. If that's not what you need please post tables that show what the result should look like.


talk is cheap, supply exceeds demand

View solution in original post

6 Replies
Gysbert_Wassenaar

Here's one:

Concat(distinct if(Quantity=aggr(nodistinct max(Quantity),Region), Name),',')


talk is cheap, supply exceeds demand
svsudhakar
Creator
Creator

Hi Gysbert,

Please find attached application with a replica of actual scenario. In this case, how can we modify the expression you have provided so that we can get the corresponding names against the maximum count of quantity in that region.

We'll have to find the count of Quantity against every region every person in that region and find the person(s) who has(have) the maximum in that region.

Thanks again...

-Sudhakar

Not applicable
Author

PFA Application

--Amay

svsudhakar
Creator
Creator

Hi Gysbert,

Please ignore the above application and consider the attached application with this post.

I have modified the Quantity to Id as we have to count the IDs against the Name and the Region.

Kindly forgive to change the scenario, but this is what is required.

Thanks and Regards,

SVS

Gysbert_Wassenaar

See attached qvw. If that's not what you need please post tables that show what the result should look like.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert,

That's a nice solution...  the count and names got are perfectly correct.

Now that suppose, the following lines are included in the data table, then for region c, both the persons should be attributed with the count 2.

Region, Name, Id, status, lob

c, gg, 29 ,0  ,LS

c, gg, 30 ,0  ,LS

As you mentioned, the following would then be the output:

Region Name with maximum count Maximum count
a aa 4
b dd 3
c ee, gg2
d aa 7

As in the first reply you provided, can we do some restrictions in the concat function, that seemed more promising to get the solution.

Thanks and Regards,

K