3 Replies Latest reply: Nov 8, 2014 6:37 AM by Robert Hutchings

# Load only Distinct and recent values only???

Hi All,

see below example for more clarity.

Input:

 Location Month Year Qty A 8 2014 10 A 8 2014 10 B 8 2014 5 B 8 2014 10 B 8 2014 7 C 8 2014 12 C 8 2014 20

Output:

Location   Month    Year    Sum(Qty)

A                  8           2014     10

B                  8           2014      7

C                  8           2014      20

Thanks,

Ashok.

• ###### Re: Load only Distinct and recent values only???

Input:

*, Location &'-' & Month & '-' & Year as LocMonYear, rowno() as Id

inline [

Location, Month, Year, Qty

A, 8, 2014, 10

A, 8, 2014, 10

B, 8, 2014, 5

B, 8, 2014, 10

B, 8, 2014, 7

C, 8, 2014, 12

C, 8, 2014, 20

];

Final:

NoConcatenate

load Location, Month, Year, Qty, Id, LocMonYear

Resident Input

where Peek(LocMonYear) <> LocMonYear

order by Id desc;

DROP Table Input;

• ###### Re: Load only Distinct and recent values only???

Hi Grossi,

Thanks for ur help.

That is what i expected.

Thanks,

Ashok.

• ###### Re: Load only Distinct and recent values only???

Here is another way of doing the same thing

I'm a big fan of not exists and use it often to eliminate duplicated entries

Or to load the first or last record etc

Input:

*,rowno() as ID

inline [

Location, Month, Year, Qty

A, 8, 2014, 9

A, 8, 2014, 10

B, 8, 2014, 5

B, 8, 2014, 8

B, 8, 2014, 7

C, 8, 2014, 12

C, 8, 2014, 20

];

Final:

NoConcatenate

Location AS ID2

Resident Input

where NOT EXISTS (ID2,Location)

order by ID desc;

DROP Table Input;

DROP FIELD ID2;