Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
simon_w58
Contributor II
Contributor II

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

View solution in original post

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

simon_w58
Contributor II
Contributor II

 

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

simon_w58
Contributor II
Contributor II

 

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