Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sorting Data - First sorted value - Pulling corresponding Text Field

Hi

I am struggling putting together a summary table for the Base set of data below.

YearTeamCount
2011A

5

2011B6
2011C4
2011D9
2012A8
2012B2
2012C4
2012D5

I want the summary table to look like the one below.

YearTeamCount
2011C4
2012B2

The table displays the Min count per year and the corresponding teams to that min count. The part i am struggling with is pulling though the corresponding teams. I have tried first sorted value but that doesn't seem to work I need a formula that pulls through the Team

Thanks for your help

13 Replies
Not applicable
Author

Please see the attached QVW, does that help?

For me (if I understood you correctly) FirstSortedValue did work, but that function depends on the sorting in your loadscript.

BTW: What I found a bit strange in my small sample app is that I couldn't sort with an inline loadscript...? It gave me a "garbage collection after load..." error (therefore a resident load). Is that normal?

Not applicable
Author

Hi

I am currently using the free version and i can't view any more files unfortunately. could you post the potential solution on the forum?

Regards

James

Not applicable
Author

No problem of course:

load script:

base:
LOAD * INLINE [
Year,
Team, Count
2011, A, 5
2011, B, 6
2011, C, 4
2011, D, 9
2012, A, 8
2012, B, 2
2012, C, 4
2012, D, 5
]

;
NoConcatenate
load * Resident base order by Count;
drop table base;

Expression for your chart

FirstSortedValue( Team,Count)

Dimension is Year

Let me know if it worked...

Not applicable
Author

Can you provide a solution as an expression.

The count is likely to change based on different selections made on the solution. The suggestion you have made suggests the count remains static

James Makepeace

MI Analyst

Southern Rock Insurance

Tel: 01454635844

Not applicable
Author

possible sugggestion.

to calculate the min count field i use this expression.

 

Min({$<[Insurer]-={'Asda OE', 'eCar'}>} [Premium])

is there another expression which works by saying return [Team] WHERE [Premium]=

Min({$<[Insurer]-={'Asda OE', 'eCar'}>} [Premium])

Not applicable
Author

Hi miteamgib,

You have to select the minimum, use the group by clause and use also the left join.

See the attached.

Regards,

Zakaria Mourchid

Not applicable
Author

Hi

i am using the feee version. i can't access your attachemnts

Regards

J

Not applicable
Author

Hi

i am using the feee version. i can't access your attachemnts

Regards

J

Not applicable
Author

His option is:

// *****  Data Source  ***************************
Data:
LOAD * INLINE [
Year, Team, Count
2011,  A,   5
2011, B,   6
2011, C,   4
2011, D,   9
2012, A,   8
2012, B,   2
2012, C,   4
2012, D,   5
]
;
/*
Sort:
load
Year,
Team,
max(Count)
Resident Data Group By Year, Team;
*/

Sort:
load
Year,
min(Count) as Count
Resident Data
group by Year;

left Join

LOAD
Year,
Count,
Team
Resident Data;


drop table Data;


But if I understand you correctly, the calculation of your count is derived from other fields, and that may be the complexity right? To solve that, I need more information on that I'm afraid...