Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
how to eliminate the duplicate rows in qlikvew
id | name |
---|---|
1 | a |
1 | a |
2 | b |
2 | c |
3 | d |
i want to o/p like this
1 a
2 b
3 d
eliminates the duplicates in id.
Use Distinct keyword before the fields.
like
Load Distinct
EmpId,
empname
From......(Location of source file)
Hi Ruben,
could you please provide an example file with your solution?
Regards,
Peter
Try this
Test:
load * inline
[
id,name
1,a
1,a
2,b
2,c
3,d
];
Final:
Load
Distinct
id as [Identifier],
name as [Final Name]
Resident
Test
Where not exists ('id',id);
Result
Script
tab1:
LOAD * INLINE [
ID, Name
1, a
1, a
2, b
2, c
3, d
];
tab2:
NoConcatenate load
ID, Name
Resident
tab1
where ID<>peek(ID)
order by ID, Name;
DROP Table tab1;
Thanx amit, got it.
I added noconcatenate and it worked.
Regards
KC
Sure, but is simple, just a script with:
Data:
LOAD * INLINE [
id,name
1,a
1,a
2,b
2,c
3,d
] Where not exists('id', id);
another one could be
tab2:
NoConcatenate load
ID, MinString(Name)
Resident
tab1
group by ID;
DROP Table tab1;
Ok Thank you.
It doesn't work with a resident load? I tried that with resident load and I got an empty table.
Regards,
Peter
That's because of autoconcatenating, use NoConcatenate to especify you don't want to concatenate tables with the same fields:
table2:
NoConcatenate LOAD .... resident table1;
I did this...
INPUT:
LOAD * INLINE [
id, name
1, a
2, a
2, b
3, c
3, d
4, a
4, b
4, c
];
OUTPUT:
NoConcatenate LOAD
id,
name
Resident INPUT where not exists('id', id);
DROP Table INPUT;