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: 
Anonymous
Not applicable

Issue in Aggr and Set

Hi All.

I want to find the Destination on Max date for every Name .

AGGR and set behaving abruptly.

Regards

erika

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try MaxString(aggr(if(NUM=max(total <Name> NUM),Dest),NUM,Dest,Name))


talk is cheap, supply exceeds demand

View solution in original post

14 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Use the firstsortedvalue function: FirstSortedValue(Dest,-Date)

See attached qvw


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Hi Gysbert,

If Dates are same then also I want some Destination to be returned.

Regards

Erika !

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Which one? If there are several Qlikview cannot know which one should be returned. You need to define extra logic so Qlikview can determine what the result should be.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I want him to return any destination.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

'Any' is not an option Qlikview knows.


talk is cheap, supply exceeds demand
its_anandrjs
Champion III
Champion III

Hi Erika,

You can try this way also

LOAD Date,

num(Date) as NUM,

Month(Date) as Month,

     Dest,

     Name

FROM

(ooxml, embedded labels, table is Sheet1);

Left Join

LOAD

Name,

Date(Max(Date)) as Maxdate

Resident Sheet1

Group By Name;

NoConcatenate

Final:

LOAD

Name,

if(Date = Maxdate, Dest) as DesinationVisit,

if(Date = Maxdate, Name) as PersonVisit,

Maxdate as DateVisit

Resident Sheet1  Where Len(if(Date = Maxdate, Name)) > 0;

//DROP Table Sheet1;

And on straight chart use fields for chart display.

PersonVisit, DesinationVisit, DateVisit

Anonymous
Not applicable
Author

I want to return the value which has smallest word.

Eg: If its Shimla and Goa then return Goa

Anonymous
Not applicable
Author

I want to do this at front end.

its_anandrjs
Champion III
Champion III

The use FirstSortedValue(Dest,-Date) as Gysbert suggested and what is your expected output let me then it will be helpful.