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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to catch a field?

Hi, my name is Ben-hur, i'm from Brazil and my english is very bad, but i will try.

I have one table with 2 fields: Sales, Name of Country.

In a text box, i want to show a name of the Country with more sales.

I tried to use AGGR, but it failed.

How can i do it?

Thanks...

1 Solution

Accepted Solutions
Not applicable
Author

Hi BenHur

Try this expression

=FirstSortedValue(  Product , - Aggr( Sum(Sales) , Product))  &  '  ' &   Max(Aggr( Sum(Sales) , Product))

regards

JJ

View solution in original post

5 Replies
swuehl
MVP
MVP

Hi Ben Hur,

if you don't have countries with identical maximum sales, you could use as expression in a text box:

=FirstSortedValue([Name of Country], -Sales)

Hope this helps,

Stefan

Not applicable
Author

Hi Ben Hur

Try  FirstSortedValue(    Country ,  -Sales )   it gives you the county where the Sales are the greater. I use the '-' to find the greater.

Regards

JJ

Not applicable
Author

Hi, sorry for this new question, but we found other problem, now in other function:

We need to show the name of Produtc with max Sum(Sales), i tried to use the same method, but it showed skewed data.

I tried it:

= FirstSortedValue(Product, -Sales) & '\n' &

Num(sum({<Product= {'$(= FirstSortedValue(Product, -Sales))'}>}Sales), 'R$ #.##0,00')

Result: Finnish Swimsuit $ 6,042.60

and it:

= FirstSortedValue(Product, -Sales) & '\n' &

Num(Max(Aggr(Sum(Sales), Product)), 'R$ #.##0,00')

Result: Finnish Swimsuit $ 13,261.61

This last sample brought the correct value, but the product is wrong. The correct product with this sales is Riviera Swimsuit.

How can i do this new expression?

Thanks for all.

Not applicable
Author

Hi BenHur

Try this expression

=FirstSortedValue(  Product , - Aggr( Sum(Sales) , Product))  &  '  ' &   Max(Aggr( Sum(Sales) , Product))

regards

JJ

Not applicable
Author

it works perfectly! Thanks!