Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to get field name out of (max(sum(xxx), 1) ... Who is the biggest?

Hi

Sorry to ask this, (i feel rather stupid that i can't work it out)...

How do i get the field name out of:

  num(max(aggr(sum([SALES VALUE]), Period, [ITEM DESCRIPTION]), 1), '£#,##0')

So i can make the label "[ITEM DESCRIPTION] = £100,000"

See attached jpg.

Thanks in advance

Thanks

Simon

1 Solution

Accepted Solutions
jolivares
Specialist
Specialist

Never a question is stupid.

There are many ways, but one of the is using firstsortedvalue() function.

firstsortedvalue(ItemDesc,Aggr(Sum(Sales)))

This function sort your values and gives you the first one.  If you want to get last value, put a :

firstsortedvalue(ItemDesc,-Aggr(Sum(Sales)))

See this for a better explanation:  FirstSortedValue function in QlikView - Part I - YouTube

View solution in original post

4 Replies
jolivares
Specialist
Specialist

Never a question is stupid.

There are many ways, but one of the is using firstsortedvalue() function.

firstsortedvalue(ItemDesc,Aggr(Sum(Sales)))

This function sort your values and gives you the first one.  If you want to get last value, put a :

firstsortedvalue(ItemDesc,-Aggr(Sum(Sales)))

See this for a better explanation:  FirstSortedValue function in QlikView - Part I - YouTube

vgutkovsky
Master II
Master II

Not 100% sure I understand the question, but why don't you just concatenate the strings together? So something like:

'Item Description = ' & num(max(aggr(sum([SALES VALUE]), Period, [ITEM DESCRIPTION]), 1), '£#,##0')

Regards,

Vlad

Anonymous
Not applicable
Author

 

firstsortedvalue([ITEM DESCRIPTION],aggr(sum([SALES VALUE]), [ITEM DESCRIPTION], Period))

The sort weight being ... aggr(sum([SALES VALUE]), [ITEM DESCRIPTION], Period)

worked well.... sort the items by sales value by month

Thanks very much for your help

Anonymous
Not applicable
Author

 

firstsortedvalue([ITEM DESCRIPTION],aggr(sum([SALES VALUE]), [ITEM DESCRIPTION], Period))

The sort weight being ... aggr(sum([SALES VALUE]), [ITEM DESCRIPTION], Period)

worked well.... sort the items by sales value by month

Thanks very much for your help