Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm using QLIK SENSE, but I'm having some difficulties, so please help.
data:
load * inline[
region_number, population
aaa/111, 988
aaa/222, 654
aaa/333, 651
bbb/111, 241
bbb/222, 755
bbb/333, 123
];
I want to add a new field to display the regions
with the most population in the same region.
The answer I want is below.
region_number, population, max
aaa/111, 988, v
aaa/222, 654
aaa/333, 651
bbb/111, 241
bbb/222, 755, v
bbb/333, 123
if ~ blahblah ~ 'v' as max,
Please let me know how to solve it.
Thank you.
Hi
Try like below
data:
load *, SubField(region_number, '/',1) as region inline[
region_number, population
aaa/111, 988
aaa/222, 654
aaa/333, 651
bbb/111, 241
bbb/222, 755
bbb/333, 123
];
join
Load region, max(population) as Max Resident data Group by region;
Final:
LOAD region_number, population, if(Max = population, 'v') as Max Resident data;
DROP Table data;