Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

remove record that have same value

Hi all,

I have a table like this

ItemNameCostRecord DatePrice
A001Apple1001/01/201715
A001Apple1002/01/201715
A001Apple1103/01/201715
A002Orange801/01/201712
A002Orange1002/01/201712
A003Mango1501/01/201718
A003Mango1502/01/201718
A003Mango1503/01/201720

I want to remove those records where Cost and Price is same as previous record (Line 2 and 7 in the table), do you have any idea on how to do that?

Thanks!

7 Replies
antoniotiman
Master III
Master III

Hi Paddy,

Temp:
LOAD Item,
Name,
Cost,
[Record Date],
Price
FROM
"https://community.qlik.com/message/1294316"
(html, codepage is 1252, embedded labels, table is @1);
NoConcatenate LOAD Item,Name,Cost,Price,FirstValue([Record Date]) as [Record Date]
Resident Temp
Group By Item,Name,Cost,Price;
Drop Table
Temp;

Regards,

Antonio

MK_QSL
MVP
MVP

Load Item, Name, Cost, Date(Min([Record Date])) as [Record Date], Price Group By Item, Name, Cost, Price;

LOAD Item,

     Name,

     Cost,

     [Record Date],

     Price

FROM

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

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

effinty2112
Master
Master

Hi Paddy,

               Without changing the script create this table with dims: Item,Name,Cost,Price and Record Date.

and the expression


if(Above(TOTAL Only(Cost))=Only(Cost) and Above(TOTAL Only(Price))=Only(Price),Null(),'Show')

Item Name Record Date Cost Price
A001Apple01/01/20171015Show
A001Apple03/01/20171115Show
A002Orange01/01/2017812Show
A002Orange02/01/20171012Show
A003Mango01/01/20171518Show
A003Mango03/01/20171520Show

In the presentation tab hide the expression column to get:

Item Name Record Date Cost Price
A001Apple01/01/20171015
A001Apple03/01/20171115
A002Orange01/01/2017812
A002Orange02/01/20171012
A003Mango01/01/20171518
A003Mango03/01/20171520

Cheers

Andrew

sunny_talwar

Another option if your data is correctly sorted

Table:

LOAD AutoNumber(Item&Cost&Price) as Key,

  Item,

     Name,

     Cost,

     [Record Date],

     Price

FROM

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

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

Where not Exists(Item) or not Exists(Cost) or not Exists(Price);

MK_QSL
MVP
MVP

By this way we are getting one line less.

     

A002Orange1002/01/201712
sunny_talwar

That makes sense... this will fix the problem

Table:

LOAD *

Where not Exists(Key);

LOAD AutoNumber(Item&Cost&Price) as Key,

  Item,

     Name,

     Cost,

     [Record Date],

     Price

FROM

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

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

Kushal_Chawda

Data:

LOAD Item,

     Name,

     Cost,

     Cost&Price as Cost_Price,

     [Record Date],

     Price

FROM

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

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

New:

LOAD *

where Flag=0;

LOAD *,

          if(Cost_Price=Previous(Cost_Price),1,0) as Flag

Resident Data

Order by Item,Name, [Record Date];

DROP Table Data;

DROP Fields Cost_Price,Flag;