Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Finding two min values within the aggr class.

Hi All,

Question: Below is the input table having following 3 fields.

I have to show min sum value, aggregated based on the Class field.

From the Class which is giving min sum value, i have to find out two min values showing the country name along with the value.

  • I had worked on the Straight table and achieved to get the following result.However it is also showing the values for other class also.

  • Later, I tried to implement it on text box which is showing the class name having min sum values .However it is showing value from other class also.

I want to show following result.

Please guide me how do we achieve this.

Thanks!!!!

1 Solution

Accepted Solutions
Kushal_Chawda

try this expression

FirstSortedValue(Class,aggr(sum(Value),Class)) & chr(10) &

min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value) & ' ' &

FirstSortedValue(Country, aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value) ,Class,Country))& chr(10) &

FirstSortedValue(aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value),Class,Country) ,

aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value),Class,Country),2) & ' ' &

FirstSortedValue(Country,aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value),Class,Country),2)

View solution in original post

5 Replies
Kushal_Chawda

Do you want this logic in script?

Anil_Babu_Samineni

How about v222??

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
Kushal_Chawda

try this expression

FirstSortedValue(Class,aggr(sum(Value),Class)) & chr(10) &

min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value) & ' ' &

FirstSortedValue(Country, aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value) ,Class,Country))& chr(10) &

FirstSortedValue(aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value),Class,Country) ,

aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value),Class,Country),2) & ' ' &

FirstSortedValue(Country,aggr(min({<Class={"$(=FirstSortedValue(Class,aggr(sum(Value),Class)))"}>}Value),Class,Country),2)

Anonymous
Not applicable
Author

@kushal chawda

Thanks for the solution. Its working as expected.

Kushal_Chawda

Glad to help