Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

Remove duplicates from Straight Table - Help!

Hi All,

I have a Straight Table data like this. Need to remove the duplicates from Straight Tabl

Cust IDAcc #Product IDPrice
18110001$10
18110002$5
110010002$5
24520001$7
29020001$7
32530001$8
32530002$6

Need to display the Minimum Price for the Maximum Acc #. If the Acc # is same for on Cust ID, then consider the Max Product ID. Output Straight Table will be like below -

Cust IDAcc #Product IDPrice
110010002$5
29020001$7
32530002$6

Can someone please help here?

4 Replies
Clever_Anjos
Employee
Employee

Please check this

maxgro
MVP
MVP

you can try this

Source:

LOAD [Cust ID],

    [Acc #],

    [Product ID],

    Price

FROM

[https://community.qlik.com/thread/225921]

(html, codepage is 1252, embedded labels, table is @1);

Final:

NoConcatenate

LOAD *

Resident Source

Where [Cust ID] <> Peek('Cust ID')

Order By [Cust ID], [Acc #] desc, Price ;

DROP Table Source;


1.png

sunny_talwar

I recommed using first sorted value for may be all of the expression (1st one can be avoided)

FirstSortedValue([Acc #], - [Acc #] - [Product ID]/10000) or Max([Acc #])

FirstSortedValue([Product ID], - [Acc #] - [Product ID]/10000)

FirstSortedValue(Price, - [Acc #] - [Product ID]/10000)

jayanttibhe
Creator III
Creator III

Hi,

Another way to handle it in the script is using Aggregation functions:

Try it - This is bit simpler with no complex functions used.

TAB1:

LOAD [Cust ID],

     [Acc #],

     [Product ID],

     Price

FROM

[https://community.qlik.com/thread/225921]

(html, codepage is 1252, embedded labels, table is @1);

TAB2:

QUALIFY*;

LOAD [Cust ID],

     Max([Acc #]) as MAX_ACC,

     Max([Product ID]) as MAX_Prod,

     Min(Price) as Min_Price

FROM

[https://community.qlik.com/thread/225921]

(html, codepage is 1252, embedded labels, table is @1)

where [Cust ID] <> ''

Group BY [Cust ID]

;

RESULT :

TAb2.Cust ID TAb2.MAX_ACC TAb2.MAX_Prod TAb2.Min_Price
1100100025
290200017
325300026